Date as format mm/yy

×

משה

Is it possible to set a date field in a table/form to display only mm/yy. In
Word 2003 I could display a date field as mm/yy, is it possible also in
Access 2007?
 
K

KARL DEWEY

Open form in design view, click on the text box, double click, scroll down
and select Properties.
Click on Data tab and in the Format property type mm\/yy and save.
 
J

John W. Vinson

That's what I thought and tried but it doesn't work

What "doesn't work"? Displays the wrong date? displays a different format?
gives an error message? sets your computer on fire?

What did you use as the Format property of the textbox, and what do you see in
the textbox?

Possible additional issue: is this in fact a Date/Time field, or is it a Text
field containing data that looks like a date?
 
R

Ron2006

Also,

Because you have put that format on it does NOT mean that is what is
being stored in the field.

AND you cannot enter data into that field on that form using that
field. A date field MUST have a month and a day and a year. One way
or the other that is what is required to enter or change information
in that field.

Ron
 
×

משה

In the display I see mm/yy and cannot enter any data [if it has set my
computer on fire I wouldn't have got the reply - lol]
The text box I am using is using a date/time property
 
D

Douglas J. Steele

Despite the fact that it only displays mm/yy, it's still a date, and you
must enter a proper date in the field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


??? said:
In the display I see mm/yy and cannot enter any data [if it has set my
computer on fire I wouldn't have got the reply - lol]
The text box I am using is using a date/time property

John W. Vinson said:
What "doesn't work"? Displays the wrong date? displays a different
format?
gives an error message? sets your computer on fire?

What did you use as the Format property of the textbox, and what do you
see in
the textbox?

Possible additional issue: is this in fact a Date/Time field, or is it a
Text
field containing data that looks like a date?
 
J

John W. Vinson

In the display I see mm/yy and cannot enter any data [if it has set my
computer on fire I wouldn't have got the reply - lol]
The text box I am using is using a date/time property

As Ron and Douglas say, if the field is a Date/Time field then you must enter
a complete date (regardless of the format). A Date/Time is stored internally
as a double float number, a count of days and fractions of a day (times) since
midnight, December 30, 1899; as such it corresponds to a precise instant of
time. September 2009 is not a precise instant of time! You can STORE
#09/01/2009 00:00:00# or #09/14/2009 11:31:28# in a DateTime field, and it
will display as 09/09 if you use a Format of mm/yy; but when you edit the
field you must enter a full date.

If you only want the month and year and don't need a real date, consider
storing two Number fields and concatenating them for display, rather than
stuffing non-date data into a date field.
 
D

David W. Fenton

m:
AND you cannot enter data into that field on that form using that
field. A date field MUST have a month and a day and a year. One
way or the other that is what is required to enter or change
information in that field.

Eh? Of course you can enter month/year and leave out the day (the
first day of the month will be supplied). You can also enter
month/day and leave out the year (the current year will be
supplied).

A mm/yyyy format combined with 00/0000 input mask pretty much takes
care of it. With or without a date mask, the control will display
the full date when it has the focus if the value has already been
filled out. So far as I know, there's no way to work around that
(and it's probably the desired behavior in most cases, though it's
not helpful with a credit card expiration date, for instance).
 
D

David W. Fenton

if the field is a Date/Time field then you must enter
a complete date (regardless of the format).

This is just NOT TRUE. There are two short-hand ways to enter dates:

mm/yyyy -- will be stored as mm/1/yyyy

mm/dd -- will be stored as mm/dd/current year

Now, there are potential problems, such as a display format that is
in conflict with the localized Windows date formats, e.g., a
computer with d/m/y default date format will have incorrect results
if you enter in m/d/y format.

Also, you must avoid mm/yy format, for two reasons:

1. the Y2K window means that guesses are made about the century
intended.

2. 2-digit years that could also be days will be interpreted as a
date, e.g., 07/13 for July 2013 will be stored as July 13, 2009.
 

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