Link to home
Start Free TrialLog in
Avatar of wduffus
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.SetFocus
        End If
    Else
   
    End If
 
End Sub

Any ideas?

Avatar of leeskelton83
leeskelton83

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.
Avatar of wduffus

ASKER

No, I'm just clicking on another of the main form tabs.
Then try to put it on the OnDeactivate event.
Avatar of wduffus

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
Avatar of Plamodo
Plamodo
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial