R
Red
Happy new year to all!!
The below code is meant to highlight if the data entered isn't a date and
prompts user to renter, however when tested by entering normal text I get a
Data Mismatch error. I'd really appreciate help on changing the code to
prevent this error.
Thanks in advance.
Private Function myStart() As Date
'define start date and finish date = start date + 18 weeks)
myStart = InputBox("Enter Report Start Date (DD/MM/YY)", "Availability
Start")
If IsDate(myStart) = False Then
MsgBox "Please re-enter the start date using the format dd/mm/yy",
vbOKOnly, "Report Date Error"
myStart = InputBox("Enter Report Start Date (mm/dd/yy)", "Availability
Start")
If IsDate(myStart) = False Then
MsgBox "Error in entering reporting start date", vbCritical, "Date
Error"
End
End If
End If
End Function
The below code is meant to highlight if the data entered isn't a date and
prompts user to renter, however when tested by entering normal text I get a
Data Mismatch error. I'd really appreciate help on changing the code to
prevent this error.
Thanks in advance.
Private Function myStart() As Date
'define start date and finish date = start date + 18 weeks)
myStart = InputBox("Enter Report Start Date (DD/MM/YY)", "Availability
Start")
If IsDate(myStart) = False Then
MsgBox "Please re-enter the start date using the format dd/mm/yy",
vbOKOnly, "Report Date Error"
myStart = InputBox("Enter Report Start Date (mm/dd/yy)", "Availability
Start")
If IsDate(myStart) = False Then
MsgBox "Error in entering reporting start date", vbCritical, "Date
Error"
End
End If
End If
End Function