E
Edward
I have two forms, say A and B. A is set to open at start and it has a button
to allow the user to open form B (without closing Form A). In my live
solution I have problems I've been unable to fathom but the code is too long
to make debugging easy.
So, I created a very simple database that does nothing more than "Msgbox"
the path taken through the Open>Load>Activate>Current events.
That shows Form_A results in this sequence of events:
Open>Load>Activate>Current, which is exactly as it should be according to the
Access documentation.
However, when I click the "Open Form B" button the events occur in this
sequence:
Form_B_Open >Form_B_Load >Form_A_Deactivate >Form_B_Activate >Form_B_Current
It's OK up to the ">Form_B_Current" but I can't understand why it goes on to
repeat the >Form_B Load >Form_B Deactivate >Form_B_Activate >Form_B_Current>
events.
The following code will fathfully reproduce it, please try it and put me out
of my misery, Thanks, Ted:
Form_A event code:
Option Explicit
Private Sub Admin_Click() ' This is a button on Form_A pointing to this
click event
DoCmd.OpenForm Form_Form_B.Name
End Sub
Private Sub Form_Activate()
MsgBox Me.Name & " Activate"
End Sub
Private Sub Form_Current()
MsgBox Me.Name & " Current"
End Sub
Private Sub Form_Deactivate()
MsgBox Me.Name & " De-Activate"
End Sub
Private Sub Form_Load()
MsgBox Me.Name & " Load"
End Sub
Private Sub Form_Open(Cancel As Integer)
MsgBox Me.Name & " Open"
End Sub
Form_B event code:
Option Compare Database
Private Sub Form_Activate()
MsgBox Me.Name & " Activate"
End Sub
Private Sub Form_Current()
MsgBox Me.Name & " Current"
End Sub
Private Sub Form_Deactivate()
MsgBox Me.Name & " DeActivate"
End Sub
Private Sub Form_Load()
MsgBox Me.Name & " Load"
End Sub
Private Sub Form_Open(Cancel As Integer)
MsgBox Me.Name & " Open"
End Sub
to allow the user to open form B (without closing Form A). In my live
solution I have problems I've been unable to fathom but the code is too long
to make debugging easy.
So, I created a very simple database that does nothing more than "Msgbox"
the path taken through the Open>Load>Activate>Current events.
That shows Form_A results in this sequence of events:
Open>Load>Activate>Current, which is exactly as it should be according to the
Access documentation.
However, when I click the "Open Form B" button the events occur in this
sequence:
Form_B_Open >Form_B_Load >Form_A_Deactivate >Form_B_Activate >Form_B_Current
Form_B_Open >Form_B Load >Form_B Deactivate >Form_B_Activate >Form_B_Current>
It's OK up to the ">Form_B_Current" but I can't understand why it goes on to
repeat the >Form_B Load >Form_B Deactivate >Form_B_Activate >Form_B_Current>
events.
The following code will fathfully reproduce it, please try it and put me out
of my misery, Thanks, Ted:
Form_A event code:
Option Explicit
Private Sub Admin_Click() ' This is a button on Form_A pointing to this
click event
DoCmd.OpenForm Form_Form_B.Name
End Sub
Private Sub Form_Activate()
MsgBox Me.Name & " Activate"
End Sub
Private Sub Form_Current()
MsgBox Me.Name & " Current"
End Sub
Private Sub Form_Deactivate()
MsgBox Me.Name & " De-Activate"
End Sub
Private Sub Form_Load()
MsgBox Me.Name & " Load"
End Sub
Private Sub Form_Open(Cancel As Integer)
MsgBox Me.Name & " Open"
End Sub
Form_B event code:
Option Compare Database
Private Sub Form_Activate()
MsgBox Me.Name & " Activate"
End Sub
Private Sub Form_Current()
MsgBox Me.Name & " Current"
End Sub
Private Sub Form_Deactivate()
MsgBox Me.Name & " DeActivate"
End Sub
Private Sub Form_Load()
MsgBox Me.Name & " Load"
End Sub
Private Sub Form_Open(Cancel As Integer)
MsgBox Me.Name & " Open"
End Sub