Effective, but slow data entry. You will need code to create your row source
and have to look through 52 or so entries in the list. Here is a function
you can use that will do what you want.
Function IsItSunday(varCheckDate As Variant) As Boolean
Dim lngDayNum As Long
Dim dtmcheckdate As Date
On Error GoTo IsItSunday_Exit
If Not IsDate(varCheckDate) Then
MsgBox "Invalid Date"
IsItSunday = False
Exit Function
Else
dtmcheckdate = CDate(varCheckDate)
End If
lngDayNum = Weekday(dtmcheckdate, vbSunday)
If lngDayNum <> 1 Then
MsgBox Format(dtmcheckdate, "short date") & " is " _
& WeekdayName(lngDayNum, False, vbSunday) & vbNewLine _
& "Last Sunday was " & DateAdd("d", vbSunday - DatePart("w",
date), date) _
& vbNewLine _
& "Next Sunday is " & DateAdd("d", vbSunday + DatePart("w",
date), date)
IsItSunday = False
Else
IsItSunday = True
End If
Exit Function
IsItSunday_Exit:
MsgBox "Invalid Format"
IsItSunday = False
End Function
To call it, put this in the Before Update event of where you enter the date:
If Not IsItSunday(Me.MyDateControL) Then
Cancel = True
End If
I would also recommend setting the Input Mask of your control to "Short Date"