FIGURE 4.1
An Employees form with review date fields.
Check that a date has been entered (or selected):
If IsDate(Me![NextReviewDate]) = False Then
GoTo ErrorHandlerExit
Else
dteNextReviewDate = CDate(Me![NextReviewDate])
intWeekday = Weekday(dteNextReviewDate)
Select Case intWeekday
Check whether selected date is a weekend day, and put up error message and exit if so:
Case vbSunday, vbSaturday
strTitle = “Wrong day of week”
strPrompt = _
“Reviews can’t be scheduled on a weekend”
MsgBox strPrompt, vbOKOnly + vbExclamation, _
strTitle
Cancel = True
GoTo ErrorHandlerExit
Case vbMonday, vbWednesday, vbFriday
Check whether selected date is the wrong day of the week, and put up error message and exit if so:
strTitle = “Wrong day of week”
strPrompt = “Reviews can only be scheduled on “ _
& “a Tuesday or Thursday”
MsgBox strPrompt, vbOKOnly + vbExclamation, _
Organizing and Communicating with Outlook 4