How to validate a date entered on a form

R

rich

Hello,

I am trying to validate a date. My table is defined with a column with a
data type of Date/Time. On the table design page, the Input Mask is:
"99/99/0000;0;_".
Currently, there is an input mask on the form where the date is entered. It
is:
99/99/0000;0;

Question: Should there be an input maks on both the table design and the
form?
Does one override the other? What is the best practice for this?

Currently, when I enter a date on the form, invalid dates are accepted.
Such as:
"02/45/2007", "14/23/2008", which are obviously not valid.

I need to ensure that for this particular form that the date entered is
greater than the current date. On the form, I have tried a validation rule
of >=Date(). Invalid dates are still being accepted by the form (prior to
saving the record. SAving the record is yet another issue...)

Can anyone point me to some good examples of input masks? I have not found
any that satisify my needs yet.

TIA,
Rich
 
J

Jeff Boyce

Rich

JOPO - just one person's opinion

I've found input masks to be confusing to users. If you click into the
field/control anywhere besides the beginning, the data entered doesn't match
up with the mask.

If you are more concerned with valid dates than the format (and you probably
should be -- Access will store dates in a special way, but you are free to
display it -- i.e., format it -- any way you wish), remove the input mask
and just test for valid dates.

In fact, if you set the underlying table field as a Date/Time data type,
Access will squawk if you enter anything besides a valid date!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top