My Program is built that it logs into a Main Menu (Startup Form).
From there you click on your selection, and a different form opens.
What I am trying to do is, every time I close a child form (a form that was opened from the main form, the following code should happen).
When I close a child form I run the following code:
In the Main Form I run this code, but it does not happen.
after reading the OnGotFocus Help, I understand that the only time this will work is, if all my controls in the main form are disabled.
How can I get the GotFocus Event Procedure to work, when I have enabled controls on the Main Form. Is there another way to do this?
Thanks in advance for you help!!
From there you click on your selection, and a different form opens.
What I am trying to do is, every time I close a child form (a form that was opened from the main form, the following code should happen).
When I close a child form I run the following code:
Code:
Private Sub Form_Close()
Forms!Main.SetFocus
DoCmd.Maximize
End Sub
In the Main Form I run this code, but it does not happen.
Code:
Private Sub Form_GotFocus()
Set mst = CurrentDb.OpenRecordset("SELECT Messages.* From Messages WHERE (((Messages.Read)=False) AND ((Messages.To)='" & Me.UserLogin & "'));")
If mst.RecordCount > 0 Then
mst.MoveLast
If mst.RecordCount = 1 Then
Me.CurrMsg.Caption = mst.RecordCount & " New" & vbCrLf & "Message"
Else
Me.CurrMsg.Caption = mst.RecordCount & " New" & vbCrLf & "Messages"
End If
End If
mst.Close
after reading the OnGotFocus Help, I understand that the only time this will work is, if all my controls in the main form are disabled.
How can I get the GotFocus Event Procedure to work, when I have enabled controls on the Main Form. Is there another way to do this?
Thanks in advance for you help!!