Forcing a true date


Posted by Robert Yerby on September 05, 2001 8:53 AM

How do I stop my macro crashing when a user inputs something which is not a date into a date field.
I've tried changing the variable from:
Dim Response1 As Date
to
Dim Response1 As Variant

But this then allows anything to be input and I really need true dates.
Can anybody help?
Thanks
Robert



Posted by Barrie Davidson on September 05, 2001 9:02 AM

Try something like this.

Date_Entry:
'Code to get date
If IsDate(Response1) = False Then
MsgBox("Incorrect Date Entry")
Go To Date_Entry
End If

Hope this helps you out.

Regards,
Barrie