Date input mask

J

John K

I have a form that has several date input mask: 99/99/0000;0;_ . I have them
auto tab to the next field. Lately after putting in all my data I copy and
paste into an excel spread sheet. Then I find out that some of the dates
have 208 instead of 2008. I don't know how this can happen since I have to
put in 4 digits in the year. I did do some testing and once in one of the
fields it did put in 208 in the year part of the year. I think I put in
01/25/2008. If I try to only put in 3 digits I get an error message and it
won't let me go on. Any idea? I didn't have this problem last year when I
was doing 2007.
 
A

Allen Browne

John, I can't tell you why it's happening (perhaps via another
setting/form/query/different mask/other issue), but can suggest some
alternatives.

Personally, I hate input masks, esp. for dates. IME, they serve only to slow
down a good data entry operator. You are forcing them to type 8 keystrokes,
whereas more than half the dates in the current year can be entered with
only 3 or 4 keystrokes if you remove the mask (e.g. just "1/25".) Input
masks also slow good data entry operaters down by not being able to back up
and insert a digit between existing ones. And they do nothing to ensure the
dates are the right way around for your regional settings.

A simple solution to blocking years like 208 is to use a validation rule on
the field:
1. Open your table in design view.
2. Select the date/time field.
3. In the lower pane, set the Validation Rule to:
(Is Null) OR (>= #1/1/1900#)

That allows the user to enter no date (null), but if they enter one, it must
be at least from 1900.

If the date is required, omit the first part, and set its Required property
to True in table design.

To force a date between 2000 and today (yet accept any time today), use:
(>= #1/1/2000#) And (< Date()+1)

If you want to just provide a warning rather than lock it down like that,
use the AfterUpdate event procedure of the control on your form to give the
warning MsgBox.
 

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