Input mask - Date/Time textfield

  • Thread starter Philo Hamel via AccessMonster.com
  • Start date
P

Philo Hamel via AccessMonster.com

Hi,

I've got a textfield in a form which holds date and time. It has a format
like this: dd-mm-yy h:nn (with a lot of spaces between the date and
the time).
The Input mask has to be like this format, so I tried: 00-00-00" "00:
00;0;_ (again with a lot of spaces, this time between the ""). But it doesn't
work the way it should. Every time I try to input a date the field wants me
to press the space bar after the yy, really annoying!
What is the right way to do this?

TIA
Philo Hamel
 
M

M Skabialka

You would probably be better off having a date field and a time field. Then
the user could enter the date in any format but you would store and display
it as dd-mm-yy, then format the other field as Short Time and only hh:mm
format entries will be allowed.

For reports and sorting, etc, just concatenate the fields.

Mich
 
P

Philo Hamel via AccessMonster.com

Thanks for the reply Mich, but.......

I really need to do it like this. Changing it to two fields would mean more
fields in tables, forms and a lot more hassle. Plus, the boss is kind of
picky and won't accept it, it would mean one more push of a button.

So please, somebody help me out here. Why is Access giving me a hard time?
What am I overlooking (or doing wrong)?

Later,
Philo
 
J

John Vinson

Hi,

I've got a textfield in a form which holds date and time. It has a format
like this: dd-mm-yy h:nn (with a lot of spaces between the date and
the time).
The Input mask has to be like this format, so I tried: 00-00-00" "00:
00;0;_ (again with a lot of spaces, this time between the ""). But it doesn't
work the way it should. Every time I try to input a date the field wants me
to press the space bar after the yy, really annoying!
What is the right way to do this?

TIA
Philo Hamel

Ummm... why use a mask AT ALL?

The data is not *stored* with blanks, after all. The Date/Time is
stored as a number. If the user types 23-06 11:30 Access will store
#06/23/2005 11:30:00#, and your format will display the date
correctly.

If you put the blanks in the input mask, you're forcing the user to
type the exact number of blanks. That's what an input mask DOES -
constrains what the user is allowed to type!

John W. Vinson[MVP]
 
P

Philo Hamel via AccessMonster.com

Hi John,
Thanks for the reply! I hope you can help me a bit more.

Ummm... why use a mask AT ALL?
The mask will show the user where to type what. It will look like __-__-__
__:__ The user has problems seeing, thats why the space between date and
time has to be bigger than just one space

If you put the blanks in the input mask, you're forcing the user to
type the exact number of blanks. That's what an input mask DOES -
constrains what the user is allowed to type!
Thats just it! The program isn't forcing me to type ALL blanks, just ONE
after the yy!? Why is that? When I use 00-00-00\ 00:00;0;_ there is no
problem, the field looks like this __-__-__ __:__ and it doesn't need a blank
typed. But 00-00-00" "00:00;0;_ shows up like __-__-___ __-__ . As you can
see there is an extra _.

Hope you can help me figure this one out.
Philo
 

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