J
John F
I have two forms that are synchronized. frmA raises a custom event that frmB
listens to. Right now, this only works if frmA is opened prior to frmB. I
would like this to also work if frmB is opened first but am having problems
implementing this.
------------------------
In frmA, the custom event is declared:
Public Event MoveSubm(strSeqNo As String)
The event is raised in when the On Current event within frmA occurs:
Private Sub Form_Current()
'Raise event to signal to frmB
RaiseEvent MoveSubm(Me.txtSeqNo)
DoEvents
End Sub
------------------------
Within frmB, I declare:
Dim WithEvents frmSub As Form_frmA
Then when frmB loads,
Private Sub Form_Load()
'Set the frmSub object
Set frmSub = Form_frmA
End Sub
Then the routine that executes within frmB when the event in frmA is raised:
Private Sub frmSub_MoveSubm(strSeqNo As String)
…
End Sub
------------------------
I realize the reason the way I have this implemented is when the frmB load
event occurs, if frmA is not already loaded, there is nothing to Set frmSub
to. I tried moving
Set frmSub = Form_frmA
to other events, but without success.
Any suggestions to allow the synchronization if frmB opens prior to frmA?
Thanks,
John
listens to. Right now, this only works if frmA is opened prior to frmB. I
would like this to also work if frmB is opened first but am having problems
implementing this.
------------------------
In frmA, the custom event is declared:
Public Event MoveSubm(strSeqNo As String)
The event is raised in when the On Current event within frmA occurs:
Private Sub Form_Current()
'Raise event to signal to frmB
RaiseEvent MoveSubm(Me.txtSeqNo)
DoEvents
End Sub
------------------------
Within frmB, I declare:
Dim WithEvents frmSub As Form_frmA
Then when frmB loads,
Private Sub Form_Load()
'Set the frmSub object
Set frmSub = Form_frmA
End Sub
Then the routine that executes within frmB when the event in frmA is raised:
Private Sub frmSub_MoveSubm(strSeqNo As String)
…
End Sub
------------------------
I realize the reason the way I have this implemented is when the frmB load
event occurs, if frmA is not already loaded, there is nothing to Set frmSub
to. I tried moving
Set frmSub = Form_frmA
to other events, but without success.
Any suggestions to allow the synchronization if frmB opens prior to frmA?
Thanks,
John