Check that the date entered is the current date

  • Thread starter Thread starter allie
  • Start date Start date
A

allie

I need to give a message if the date entered is not the
current date.
I wrote:
if txtdate <> date then
msgbox "the date entered is not today's date
end if

txtdate = name of date field on form
date = date function

It does not work. It is taking the date entered in
txtdate and assigning it to date.

please help

Thanks
 
Why not just make today's date the default and not allow the user to enter anything in the date field?
 
I thought of that but the date in the field does not
always have to be the current date, and the users do not
want to always have to delete. They prefer a prompt.

-----Original Message-----
Why not just make today's date the default and not allow
the user to enter anything in the date field?
 
Solution

I put an unbound textbox on the form called it
txtCurrentDate and set the default value to Date()

On the exit event of the txtDate field I put the following

if txtDate <> txtCurrentDate then
msgbox "The date entered is not today's date"
End if
 
Back
Top