wduffus
asked on
MsgBox prompt on exit from tabbed form
I have a tabbed form in Access 2000. When leaving my Call Activity tab, I want to generate a MsgBox reminding me to fill in a follow-up call date on the sub-form if the text field is null. The present code (that doesn't work) is:
Private Sub Form_LostFocus()
If txtCallBackDate Is Null Then
MsgBox ("Do you want to set a call back date?"), vbYesNo, ("Schedule Callback")
If vbYesNo = -1 Then
Form_frmCallActivitySub.Se tFocus
End If
Else
End If
End Sub
Any ideas?
Private Sub Form_LostFocus()
If txtCallBackDate Is Null Then
MsgBox ("Do you want to set a call back date?"), vbYesNo, ("Schedule Callback")
If vbYesNo = -1 Then
Form_frmCallActivitySub.Se
End If
Else
End If
End Sub
Any ideas?
Are you closing the form with a command button? If so, paste your code to the OnClick event of it and it will run before it closes.
ASKER
No, I'm just clicking on another of the main form tabs.
Then try to put it on the OnDeactivate event.
ASKER
I tried the above code under Private Sub Form_Deactivate() in frmCallActivitySub and it doesn't work there either. Is this supposed to be in my subform or the main form?
Yes I see now. You may have to approach this a different way. Perhaps you can make your code run on the LostFocus or AfterUpdate event of a text box or other control. How is your form set up?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.