Bringing an open Access form in the background to the front (1 Viewer)

tehNellie

Registered User.
Local time
Today, 05:39
Joined
Apr 3, 2007
Messages
751
I'm sure this should be dead easy, but I'm obviously not searching the right keyword.

I have two forms open. I do something on the form that is currently active that makes a change to the open form in the background. So far, so good. What I want to do now is bring the form open in the background to the foreground and make it the active window.

I've tried variations on forms!frmBackgroundform.Activate and .show to no avail.
 

tehNellie

Registered User.
Local time
Today, 05:39
Joined
Apr 3, 2007
Messages
751
Thanks. Wood for the trees and all that, you have no idea how long I spent typing crap into google/here for that.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 21:39
Joined
Aug 30, 2003
Messages
36,125
No problem; sometimes the hardest part is finding the right thing to search on.
 

tehNellie

Registered User.
Local time
Today, 05:39
Joined
Apr 3, 2007
Messages
751
I guess as a somewhat related question, .SetFocus doesn't appear to trigger the form.gotfocus() event is any event triggered on the forum by .setfocus?
 

A Waterman

New member
Local time
Yesterday, 21:39
Joined
Jul 7, 2010
Messages
4
The Form GotFocus event fires only if there are no enabled controls on the form
 

MarkK

bit cruncher
Local time
Yesterday, 21:39
Joined
Mar 17, 2004
Messages
8,181
Check out the form's Activate event. I expect MyForm.SetFocus will raise MyForm's Activate event if MyForm is not the active form.
 

A Waterman

New member
Local time
Yesterday, 21:39
Joined
Jul 7, 2010
Messages
4
I think the GotFocus event of the first enabled visible field will fire too, even thought the form GotFocus doesn't.

I am up on this because I am trying to "return" to a form which opened a popup modal form (basically a custom dialog box), but the form I want to "return " to ends up behind the switchboard after the popup closes. You can do <form name>.setfocus, from some event in the popup, but because the popup is still active, it prevents <form name> from coming to the front (popup is always on top), and then when finally the popup closes, the swtchboard is the front form. I have tried doing the setfocus in the close event and the deactivate event of the popup. The deactivate event doesn't seem to fire at all. I'm running out of tricks. Maybe it is beer o' clock.

The switchboard is non modal non popup - just a plain old form. I don't know why it puts itself in front of the other form. I also thought of making the switchboard go to the back, but I don't see a way to do that either.

I note also the following lines from the ACCESS help for the PopUp property topic

"You can set this property by using the form's property sheet, a macro, or Visual Basic.
The PopUp property can be set only in form Design view."

I tried it and it doesn't seem to like setting the popup property from code. me.popup = false doesn't seem to be a winner.
 
Last edited:

A Waterman

New member
Local time
Yesterday, 21:39
Joined
Jul 7, 2010
Messages
4
I got around this by setting the original form's timer interval (500ms) from within the popup form, and doing what I wanted to do in the Timer event of the original form including setting TimerInterval = 0, me.visible=false, and then me.visible = true (brings it forward).

By the time the timer goes off in the original form the popup window has gone away. The invisible/visible thing is enough to put the original form in front of the switchboard.

Tacky, but it works.
 

Users who are viewing this thread

Top Bottom