Date format!

J

jenny

I am trying to create a way that will display a date in "month date, year"
format (for example "February 21, 2007") but also have the ability to only
enter the "year" or just the "month year" (February 2007). Also, I'm not
sure if this is done as a format or input mask. Any help would be
appreciated!! Thanks
 
D

Douglas J. Steele

Can't be done, at least, not using a Date field.

February 2007 isn't a date. Dates are stored as 8 byte floating point
numbers, where the integer portion represents the date as the number of days
relative to 30 Dec, 1899, and the decimal portion represents the time as a
fraction of a day.

You could, I suppose, store your pseudodates as text, but querying them
would be problematic, to say the least.
 
F

fredg

I am trying to create a way that will display a date in "month date, year"
format (for example "February 21, 2007") but also have the ability to only
enter the "year" or just the "month year" (February 2007). Also, I'm not
sure if this is done as a format or input mask. Any help would be
appreciated!! Thanks

To display a Date as February 21, 2007, simple write:
mmmm dd, yyyy
in the Format property of the Field.

However, a DateTime field must be a valid date it has a month, day,
and year portioin). Entering just a year (i.e. 2007) is NOT a valid
date. Neither is entering a Month and Year... but.... Access will
assume that any entry into a date field, such as 12/2007 will be the
first day of the 12th month, so it will store 12/1/2007. If however,
you enter 12/5 Access will make the assumption that the date is
12/5/current year.
It's not a good idea to make Access assume anything.
Enter a full date. If you don't care about the day of month, enter a 1
as the day anyway.
A mask forces data entry in a particular manner. Often times they
cause more problems than they avoid.
 

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