I have the following code which checks the combobox to ensure it matches a certain value, and if it does the code then goes onto do a date validation check for me. If the date validation check fails I want a YesNo message box to appear to prompt the user to go back and enter/update the date. Code so far:
The first part works. It manages to check all the values of the 'ClientStatus' combobox and if a value matches it happily exits the sub. The problem I'm having is with the second section. I'm getting invalid use of Null on the If (CDate(Me.FollowUpDate) <= Date). I'd like to also be able to handle a no date value too i.e. if the date is null or <= to, then please input/update date
Trust that all makes sense?
Code:
Private Sub Command60_Click()
Dim sStatus As String
sStatus = Me!ClientStatus & ""
If sStatus <> "Trying to Contact" And sStatus <> "Appointment Booked" And sStatus <> "Appointment Completed" And sStatus <> "DIP Completed" And sStatus <> "Sign Up Booked" And sStatus <> "Signed Up" And sStatus <> "Contacted - Keeping in contact" Then
DoCmd.Close
[Forms]![MainMenu]![FollowUpList].Requery
Exit Sub
End If
If (CDate(Me.FollowUpDate) <= Date) Then
MsgBox ("The follow up date has not been changed to a date in the future. Do you want to update this now?")
Exit Sub
DoCmd.Close
[Forms]![MainMenu]![FollowUpList].Requery
End If
End Sub
The first part works. It manages to check all the values of the 'ClientStatus' combobox and if a value matches it happily exits the sub. The problem I'm having is with the second section. I'm getting invalid use of Null on the If (CDate(Me.FollowUpDate) <= Date). I'd like to also be able to handle a no date value too i.e. if the date is null or <= to, then please input/update date
Trust that all makes sense?