input mask Need DATE/TIME field to = MM/YYYY

T

Tinadawn

In my NEW table that I just created, under the Imput mask, I have created
00/0000 because I want only the MONTH and YEAR to appear. 12/2004. but when
I save my table, and type in the 12/2004 it adds in the DAY = 12/1/2004.

I have the Format box blank.
 
D

Dirk Goldgar

Tinadawn said:
In my NEW table that I just created, under the Imput mask, I have
created 00/0000 because I want only the MONTH and YEAR to appear.
12/2004. but when I save my table, and type in the 12/2004 it adds
in the DAY = 12/1/2004.

I have the Format box blank.

In Access, the date/time data type is designed to identify a moment in
time, and so it always includes month, day, year, and time of day,
whether you enter all of those values or not, and whether you format it
so as to display them or not. If the time is not specified, it's always
midnight on the date given. If you enter only month and year, you are
understood to mean the first of the month, and that is what is stored.

You have two choices:

1. Don't use a date/time field; instead, use two fields, one for the
month and one for the year.

2. Use a date/time field, but set both the InputMask property (which
governs what you see when the field has the focus) and the Format
property, so that only the month and year are displayed. Setting the
Format property to "mm/yyyy" (without the surrounding quotes) will do
this. But be aware that the values stored will actually include the day
of the month, equal to 1, whether you display them or not. This can
trip you up later, if you aren't careful.
 
Top