I want to make a field blank after an entry has been erroneously made and
a MsgBox has advised the user that the entry they have made is incorrect.
Foe example I have a date field (formatted to short date) which requires the user
to input a date greater than today. I have got the MsgBox to work but keep getting
error messages with the code below the MsgBox line. Ideally I want the user to be returned to
that date field which should be blank allowing them to enter a correct value.
.Code:If txtNextAppointment < Date Then MsgBox "Entre una fecha más que hoy", vbOKOnly (This is Spanish for "Enter a date greater than today") Me.Undo End If
The above code returns today´s date, and puts it in the txtNextAppointment field, albeit it was never placed in that field by the user.
I have tried other pieces of code e.g. Me.txtNextAppointment.SetFocus
Me.txtNextAppointment.Value = ""
Me.txtNextAppointment.Cancel
I am sure it will be a simple line of code, but I cannot find the correct syntax.
Any help will be much appreciated.
Regards
Cheyanne