When doing something that is based on the Value entered in a Control, you need to use the Control's BeforeUpdate event:
Code:
Private Sub cboDatePick_BeforeUpdate(Cancel As Integer)
If Weekday(Me.cboDatePick) <> 5 Then
Beep
MsgBox "You need to pick a date which falls on a Thursday...", vbInformation, "Oops!"
Cancel = True
DoCmd.ClearMacroError
End If
End Sub
But you cannot Move to another Control from this event until the Control's Value is saved, so you need to move that piece of code into another event:
Code:
Private Sub cboDatePick_Exit(Cancel As Integer)
Me.btnOpenSchedule.SetFocus
End Sub
I'm curious about something, though! The name cboDatePick would seem to indicate that the Control is a Combobox, and if this is true, why are non-Thursday Dates available?
Also note that I left the line
DoCmd.ClearMacroError
in place, although I have no idea why it is there, since it has nothing to do with this task!
Linq ;0)>