Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Month and Year only

Status
Not open for further replies.

hubs99

Programmer
Jul 9, 2004
17
US
I'm trying to set up a field which only takes in only the month and year. I tried setting the data type to "Date", the Format to "m/yy" and the input mask to "00/00;;_"

When i enter data into this i.e. 01/01 it records it as 01/01/04.


Any ideas what I'm doing wrong? Thanks for all your help.
 
Hi,

A DATE is really just a number like today is 38260.

What you see is just a format. Access is probably assuming day 1 of the month & year that you enter.

Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
But if i enter 8/02 it is translated into 08/02/2004 instead of making it 08/../2002 like i'm hoping.

I dont care if it has to make it 08/01/02 for 08/02 but I was hoping there was an easy way to automatically do this for me so I could type in 0802 and have it enter 08/01/02 for the date. Am I making any sense?


Thanks for you help.
Justin
 
Justin,

I guess that it can't read your mind. It just did the best it could, and it appears that that was just not good enough for you!

To be sure, specify year, month and day!

Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
Its just frustrating because I know it has the ability to do this (Enter mm/yy only). And at one point I had it working but something goofed and I cannot replicate what I had done previously or it is because of another intervening element(link or form) that this has stopped working? Its doesnt have to be psychic, its a feature that is supposed to work. I guess that means I must become psychic in order to figure out this feature.


Thanks Skip
 
Well,

As you are a Programmer (by your tag line), you hopefully do not have users entering data in the table directly. Using the form for data entry, allow the users to type the 00/00 format you want into an unbound field and then convert and store this into the date field you want to record the data into. This will provide the users the input format necessary and allow you the freedom of control.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
Network Admin/Access Programmer
 
>Using the form for data entry, allow the users to type the
>00/00 format you want into an unbound field and then convert
>and store this into the date field you want to record the
>data into.


This is what I'm struggling to figure out. I do not have the user adding/editing the data in the table. I'm trying to figure out how the user can enter mm/yy into the form and have it put mm/01/yy into the table? I guess that would be the best clarification at this point. Thanks mstrmage

 
hubs99 said:
I tried setting the data type to "Date"
Because if you put something that is NOT a date, but CLOSE to a date, Access has to FORCE it into a Date. So he makes some assumptions.

Access' assumptions and YOUR assumptions, just never came together!

Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
OKay....

You have an unbound control for the users to type in the date. Set the format property to 00/00;0 You have a control bound to the date field in the table. You can even hide this one. Using the afterupdate event of the unbound control, you put the following code:

Me![boundcontrolname] = DateSerial(Right(Me![unboundcontrolname], 2), Left(Me![unboundcontrolname], 2), 1)

or something there abouts

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
Network Admin/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top