T
Tok
I'm trying to open a pop-up form from my main form only for display purposes.
The trouble is, when the popup form opens I cannot seem to setfocus back to
the main form in VB. It works when I manually click back on the main form in
normal view.
I tried using the "OnLostFocus" event for the main form, but it never even
fires when the popup window opens and grabs the focus.
Here's the code I'm trying from my main form's button named "TogglePopUp":
Private Sub TogglePopUp_Click()
If IsLoaded("frm PopUp") Then
DoCmd.Close acForm, "frm PopUp"
Else
DoCmd.OpenForm "frm PopUp", acNormal
End If
Me.Textbox1.SetFocus
End Sub
I was thinking the code was executing too fast and that the main form hadn't
lost the focus yet before the popup window opened. So I had put a huge For
Next loop just before the "Me.Textbox1.SetFocus" line as a test to delay it's
execution, but that still didn't work.
Any help would be appreciated! Thanks.
The trouble is, when the popup form opens I cannot seem to setfocus back to
the main form in VB. It works when I manually click back on the main form in
normal view.
I tried using the "OnLostFocus" event for the main form, but it never even
fires when the popup window opens and grabs the focus.
Here's the code I'm trying from my main form's button named "TogglePopUp":
Private Sub TogglePopUp_Click()
If IsLoaded("frm PopUp") Then
DoCmd.Close acForm, "frm PopUp"
Else
DoCmd.OpenForm "frm PopUp", acNormal
End If
Me.Textbox1.SetFocus
End Sub
I was thinking the code was executing too fast and that the main form hadn't
lost the focus yet before the popup window opened. So I had put a huge For
Next loop just before the "Me.Textbox1.SetFocus" line as a test to delay it's
execution, but that still didn't work.
Any help would be appreciated! Thanks.