Date Format

D

David

Hi!

How to set my date format on the Form to mm/dd/yy?
So that the user can key in the value accordingly.
The user will be disallowed to key in the value if the value entered is
invalid.
Any idea how to do that? Thks!
 
D

Douglas J. Steele

Access gets its date format from whatever's been defined in the Regional
Settings (in the Control Panel). However, before you go and alter
everyone's Regional Settings, why would you want to force them to enter the
date in a specific format? The format doesn't make any difference to how the
date's stored: it's stored as an 8 byte floating point number, where the
integer portion represents date as the number of days relative to 30 Dec,
1899, and the decimal portion represents time as a fraction of a day. To me,
it makes absolutely no sense to force your user to use a different format
than he or she prefers.

You may find it informative to read Allen Browne's "International Dates in
Access" at http://members.iinet.net.au/~allenbrowne/ser-36.html
or what I have in my September 2003 Access Answers column for Pinnacle
Publication's "Smart Access" newsletter. (The column and accompanying
database can be downloaded at
http://www.accessmvp.com/djsteele/SmartAccess.html)
 
S

Steve Schapel

David,

In addition to Doug's remarks, it may be worth pointing this out... You
can set the Format property of the textbox on your for to display the
date in any way you want. In this case, set it to "mm\/dd\/yy". After
data entry, the date will be displayed in this format, regardless of the
way in which the data entry is done. Therefore, there is normally no
need to restrict the data entry, as regardless of the data entry, the
same value is being entered (assuming it is a valid date). So your user
could enter today's date in any of these ways (and more)...
5/16/5
May 16 2005
05-16-2005
16 May 05
16-May-05
etc
etc
.... and in all cases:
1. the data which is saved in the table will be identical in each case
2. the form will display it as 05/16/05 regardless
 
A

adsl

David said:
Hi!

How to set my date format on the Form to mm/dd/yy?
So that the user can key in the value accordingly.
The user will be disallowed to key in the value if the value entered is
invalid.
Any idea how to do that? Thks!
 
A

adsl

Douglas J. Steele said:
Access gets its date format from whatever's been defined in the Regional
Settings (in the Control Panel). However, before you go and alter
everyone's Regional Settings, why would you want to force them to enter
the date in a specific format? The format doesn't make any difference to
how the date's stored: it's stored as an 8 byte floating point number,
where the integer portion represents date as the number of days relative
to 30 Dec, 1899, and the decimal portion represents time as a fraction of
a day. To me, it makes absolutely no sense to force your user to use a
different format than he or she prefers.

You may find it informative to read Allen Browne's "International Dates in
Access" at http://members.iinet.net.au/~allenbrowne/ser-36.html
or what I have in my September 2003 Access Answers column for Pinnacle
Publication's "Smart Access" newsletter. (The column and accompanying
database can be downloaded at
http://www.accessmvp.com/djsteele/SmartAccess.html)
 
A

adsl

Steve Schapel said:
David,

In addition to Doug's remarks, it may be worth pointing this out... You
can set the Format property of the textbox on your for to display the date
in any way you want. In this case, set it to "mm\/dd\/yy". After data
entry, the date will be displayed in this format, regardless of the way in
which the data entry is done. Therefore, there is normally no need to
restrict the data entry, as regardless of the data entry, the same value
is being entered (assuming it is a valid date). So your user could enter
today's date in any of these ways (and more)...
5/16/5
May 16 2005
05-16-2005
16 May 05
16-May-05
etc
etc
... and in all cases:
1. the data which is saved in the table will be identical in each case
2. the form will display it as 05/16/05 regardless
 
Top