I have an MDIChild form with subsequent text boxes. On the lost focus event of each text box I perform a calculation and then call a procedure also on the form:
Private Sub Text1_LostFocus
'Do a calculation
CallSub
End Sub
Private Sub Text2_LostFocus
'Do a different calculation
CallSub
End Sub
The procedure called in the form ('CallSub') has error handling which calls a procedure called "Initialise" on a form called frmError (which is an MDIChild form):
Private Sub CallSub
On Error Goto CallSub_Err
'Do Something
Exit Sub
CallSub_Err:
frmError.Initialise Err, "Err Msg"
End Sub
This "Initialise" procedure on the Error form sets some objects and at the end:
Me.Show vbModal
Should an error occur in, for example, Text1_LostFocus the error form is called as expected. However, I am finding after Me.Show vbmodal is called in the frmError Initialise procedure, the Text2_LostFocus event is being called and again if an error happens it attempts to load frmError. When it gets to the Me.Show vbmodal I then get 'Run time error 400, Form already displayed, can't show modally'.
Bit of a newby I admit but I was hoping no further events would be called after the first Me.Show vbmodal until the user has closed the modally shown Error form.
Hope you can help.
Private Sub Text1_LostFocus
'Do a calculation
CallSub
End Sub
Private Sub Text2_LostFocus
'Do a different calculation
CallSub
End Sub
The procedure called in the form ('CallSub') has error handling which calls a procedure called "Initialise" on a form called frmError (which is an MDIChild form):
Private Sub CallSub
On Error Goto CallSub_Err
'Do Something
Exit Sub
CallSub_Err:
frmError.Initialise Err, "Err Msg"
End Sub
This "Initialise" procedure on the Error form sets some objects and at the end:
Me.Show vbModal
Should an error occur in, for example, Text1_LostFocus the error form is called as expected. However, I am finding after Me.Show vbmodal is called in the frmError Initialise procedure, the Text2_LostFocus event is being called and again if an error happens it attempts to load frmError. When it gets to the Me.Show vbmodal I then get 'Run time error 400, Form already displayed, can't show modally'.
Bit of a newby I admit but I was hoping no further events would be called after the first Me.Show vbmodal until the user has closed the modally shown Error form.
Hope you can help.