Probably an error trapping question, something I am weak on. I have an input box for a string that I take and then turn into a date with cdate. If the user submits a string that cannot be turned into a date the code stops and returns "runtime error 13 type mismatch." I'd rather the code keep running and throw up a custom error message.
Private Sub Command3_Click()
Dim datestring As String
Dim datedate As Date
datestring = InputBox("What day? MM/DD/YYYY", "Date")
If Not IsNull(datestring ) And datestring <> "" Then
datedate = CDate(datestring)
MsgBox datedate
Else
MsgBox "empty"
End If
Private Sub Command3_Click()
Dim datestring As String
Dim datedate As Date
datestring = InputBox("What day? MM/DD/YYYY", "Date")
If Not IsNull(datestring ) And datestring <> "" Then
datedate = CDate(datestring)
MsgBox datedate
Else
MsgBox "empty"
End If