Month and year only

G

Guest

Hi,

I want to use a month field in the form of MMM YY e.g. Jul 07. Do I have to
create some form of input mask and format in order to do this or create two
different fields.

Thanks

Andy
 
G

Guest

In the textbox where the data is choose MMMM YY for format (typ it in
yourself) that should do the trick.

hth
 
G

Guest

Thanks that has sorted out the formattign of the date but it is restricting
the year to 2007 only it wont allow anything after Dec 07, automatically
changing anything with a 2008 year to 2007.

Do I have to do further changes?

Thanks Andy
 
G

Guest

Hi Andy,

Formatting a textbox doesn't put any restrictions on the data entered. So
there has to be something else going on. Provide us with some more details
like:

are you referring to a textbox, what's the datatype entered into the textbox
(if it's a datefield it should display 08 as well).
 
J

John W. Vinson

Hi,

I want to use a month field in the form of MMM YY e.g. Jul 07. Do I have to
create some form of input mask and format in order to do this or create two
different fields.

Thanks

Andy

A Date/Time field, no matter how it's displayed, is actually stored 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 an exact point of time.
Jul 07 (meaning July 2007) is *not* an exact point in time!

What's happening is that if you enter Jul 07 in the textbox, Access is
assuming you mean the 7th of July and entering the current year by default.
The Format indicates that you want to SEE the two-digit year, but that has
absolutely no effect on how Access reads what you type. A month name and two
digits *will* be interpreted as a month and day. I was curious enough to try
entering "Jul 99" into a textbox - it stores July 1, 1999, evidently since 99
makes sense as a year but not as a day.

If you want to force storage of a year, you'll need a four digit year. And if
you don't care about the day, I'd really suggest using two number fields for
the year (four digit year!!!!) and the numeric month, just so you can sort
chronologically. You could use combo boxes for data entry, e.g. a row source
of

1;"Jan";2;"Feb";3;"Mar" <etc>

with a column count of 2 and a bound column of 1 to enter the month, and just
a list of valid years.

John W. Vinson [MVP]
 
G

Guest

Hi John,

Thank you for the extended clarification on this one. Very well put. I was
under the assumption that Andy was using a 'complete' datefield and only
wanted to see the month and the year extracted from that. But reading you
answer and rereading the original post I guess Andy is using a textbox where
only the month and year are displayed and answered.
Good piece of information though ;-)
 

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

Similar Threads


Top