I am implementing some error checking in a form and want to ensure that the user cannot put in dates that are in the future or where Session Date is before DOB...here's my code:
When I try to complete the form and hit ok I get and error. When i debug it highlights the first line of code above with the message: "Runtime Error 424, Object required".
Does the order in which the data is inputted matter or what could be causing this not to run correctly?
Code:
If CDate(SessionBox.Value) > Format(Date$, "dd/mm/yyyy") ThenMsgBox "Session Date cannot be in the future, please check and amend!"", vbExclamation"
Exit Sub
End If
If CDate(SessionBox.Value) < CDate(DOBTextBox.Value) Then
MsgBox "Session cannot be before DOB, please check and amend!", vbExclamation
Exit Sub
End If
If CDate(DOBTextBox.Value) > Date$ Then
MsgBox "DOB cannot be in the future, please check and amend!"", vbExclamation"
Exit Sub
End If
When I try to complete the form and hit ok I get and error. When i debug it highlights the first line of code above with the message: "Runtime Error 424, Object required".
Does the order in which the data is inputted matter or what could be causing this not to run correctly?