Eljefegeneo
Still trying to learn
- Local time
- Today, 11:13
- Joined
- Jan 10, 2011
- Messages
- 902
I have a code that works up to a point. If a {Day} is filled in and there is no corresponding [Time], then a message box pops up, telling the user to insert a time. However, if no time is known and wants to just save the [Day] data, the form should close.
If Not IsNull(Day) And (IsNull(Time) Or Time = "") Then
MsgBox "Please make a selection for Time", vbOKCancel, "Time Selection Not Complete!"
If vbOK Then
DoCmd.CancelEvent
Me.Time.SetFocus
Else
DoCmd.Close acform, "frm1", acSave
End If
End If
I can't get the second part, the else part to work. The form won't close, the focus goes to [Time]. What am I doing wrong?
If Not IsNull(Day) And (IsNull(Time) Or Time = "") Then
MsgBox "Please make a selection for Time", vbOKCancel, "Time Selection Not Complete!"
If vbOK Then
DoCmd.CancelEvent
Me.Time.SetFocus
Else
DoCmd.Close acform, "frm1", acSave
End If
End If
I can't get the second part, the else part to work. The form won't close, the focus goes to [Time]. What am I doing wrong?