Solved Focus on form open via VBA (1 Viewer)

GK in the UK

Registered User.
Local time
Today, 15:25
Joined
Dec 20, 2017
Messages
211
I have a login form which opens to the user name field which is what I want.

On login, it opens a menu form and closes itself.

When we log out, it opens the login form and the menu form hides.

But on subsequent opens the focus goes to the Access object list. I have to click in the user name field.

I tried this (SetFocus) in the menu form but focus still goes to the Access object pane:

Code:
Private Sub cmdLogout_Click()
  LogUserOut
  DoCmd.OpenForm (gstrFrmLogin)
  Forms(gstrFrmLogin).SetFocus
  Me.Visible = False    ' frm_menu (this form) is intended to never close, mSessionID is retained in here
  'DoCmd.Close acForm, Me.Name
End Sub
How can I get focus back to the opened form ?
 

arnelgp

error reading drive A:
Local time
Today, 22:25
Joined
May 7, 2009
Messages
9,925
I think its a matter of re-arranging the code in your cmdlogout_click.
 

GK in the UK

Registered User.
Local time
Today, 15:25
Joined
Dec 20, 2017
Messages
211
Yes, it was that. .SetFocus after hiding. Thank you.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom