Date stuff

A

Allen Browne

Hi Derek.

It might help to understand how Access works, so you can then choose the
best way for you to work.

Internally, Access stores date/time fields as real numbers, where the
integer part represents the date, and the fractional part the time. There is
therefore no such thing as a date/time value in Access that has no day: the
number Access stores always has a full date and time, regardless of the
formatting you specify to tell Access how to display the value.

If you want something different, you have several choices, such as:
a) Use two number fields:
TheMonth Number (Integer) Validation Rule: Between 1 And 12
TheYear Number (Integer) Validation Rule: Between 1980 And 2999

b) Use a date/time field, but on your form interface it with a pair of
unbound text boxes populated in Form_Current and written in
Form_BeforeUpdate to the field using whatever day you want to assume (such
as 1st or last of month.)

c) Use a text field (not recommended if you need to do *any* searches or
criteria.)
 
D

Derek Brown

Hi all
I would like the user to be able to enter just the month and year in a date
field, the day being redundant. I can use mm/yy and i have tried input mask
as 00/00 which works if you enter a year number greater than 12 as Access
then realises that you are entering month and year but it reads years of
less than 12 as the month so you get:
01/01 as 01/01/05
01/99 as 01/01/99 consistant or what?

Also it has that extreamly anoying feature of reverting to the full date the
moment you re-enter the field.
I don't realy want to set up another field to read the entry and convert a
number field to date if i can help it. Any solutions?
 
D

Derek Brown

Thanks Allen

Allen Browne said:
Hi Derek.

It might help to understand how Access works, so you can then choose the
best way for you to work.

Internally, Access stores date/time fields as real numbers, where the
integer part represents the date, and the fractional part the time. There
is therefore no such thing as a date/time value in Access that has no day:
the number Access stores always has a full date and time, regardless of
the formatting you specify to tell Access how to display the value.

If you want something different, you have several choices, such as:
a) Use two number fields:
TheMonth Number (Integer) Validation Rule: Between 1 And 12
TheYear Number (Integer) Validation Rule: Between 1980 And 2999

b) Use a date/time field, but on your form interface it with a pair of
unbound text boxes populated in Form_Current and written in
Form_BeforeUpdate to the field using whatever day you want to assume (such
as 1st or last of month.)

c) Use a text field (not recommended if you need to do *any* searches or
criteria.)
 
Top