Hi,
if I want only the 4-digit format for a year (e.g., 2006), can I set a
date/time format to something like "yyyy'? I can't get it to work. Or are
my only options to set it to number or text data format? And if I do that,
am I going to run into any problems with a query range?
What "doesn't work"? "yyyy" is a perfectly good format for a date.
Access will store - and require you to enter - a complete date;
date/time values, regardless of format, are stored as Double Float
numbers, a count of days and fractions of a day since midnight,
December 30, 1899. What will be stored in the table is (say)
39053.9100462963 which is equivalent to 12/2/2006 9:50:28 PM; if you
display that value in a textbox with a format of "yyyy" you'll SEE
just 2006. If you try to edit the textbox though you'll have to type
in a full valid date.
If you only want to STORE a four digit number, and work with it as a
four digit number rather than a precise point in time, then I'd
suggest using an Integer. You can search integerw with a range like
BETWEEN 1994 AND 2001
perfectly well; the only thing that won't work directly is searching
between actual date values. You could, however, use
BETWEEN 1994 AND Year(Date())
to get all values through this year.
John W. Vinson[MVP]