I need to check a date field to be sure the user enters an end-of-month date (e.g., 1/31, 2/28, etc.) I've started writing the code, but keep getting an error about saving the field. I don't want to save the field. What I want to have happen is: if the date is not an end-of-month date, show a message box and return the cursor to the date field ... what am I missing (something simple, I'm sure)...here's what I have so far:
Private Sub StatusDate_BeforeUpdate(Cancel As Integer)
If Month(StatusDate) = 1 And Day(StatusDate) <> 31 Then
MsgBox "Date must be end of month", vbExclamation
StatusDate.SetFocus
Cancel = True
End If
End Sub
Private Sub StatusDate_BeforeUpdate(Cancel As Integer)
If Month(StatusDate) = 1 And Day(StatusDate) <> 31 Then
MsgBox "Date must be end of month", vbExclamation
StatusDate.SetFocus
Cancel = True
End If
End Sub