Date problem

  • Thread starter forcefield via AccessMonster.com
  • Start date
F

forcefield via AccessMonster.com

Hi everyone,
I would like my date field formatted dd/mm/yy or dd/mm/yyyy in my form
regardless of regional setting as different computer has different regional
setting. So when user keys in the date, he may key in dd/mm/yy or dd/mm/yyyy.
If he decides to key in dd/mm/yy it automatically changes to dd/mm/yyyy. Any
suggestion please

Thank you
 
W

Wolfgang Kais

Hello "forcefield".

forcefield said:
Hi everyone,
I would like my date field formatted dd/mm/yy or dd/mm/yyyy in my
form regardless of regional setting as different computer has
different regional setting. So when user keys in the date, he may
key in dd/mm/yy or dd/mm/yyyy. If he decides to key in dd/mm/yy it
automatically changes to dd/mm/yyyy. Any suggestion please

The format of a field or textbox has nothing to do with an input mask.
Have you tried to use the format dd\/mm\/yy ?
 
F

forcefield via AccessMonster.com

Hi Kais,
Format for my text box, Sdate is dd/mm/yyyy and its input mask is
00/00/0099;0; Everything runs fine if user keys in dd/mm/yyyy. If User were
to key in say, 29/05/07 , the text box will automatically reverts back to
07/05/2029 which is incorrect. I expect 29/05/07 changes to 29/05/2007 but
it did not happen.

Thanks.
 
D

Douglas J. Steele

That's as designed if the user's Regional Settings have the Short Date
format set to mm/dd/yyyy.

The only way you can get around this would be to have the field unbound, and
put logic in its AfterUpdate event to interpret the input how you want, and
then pass that value to the actual field in the recordset. You'd also have
to include code in the form's Current event to take the value from the
recordset and write it to the unbound text field.

In my opinion, you're violating a basic rule of programming by forcing the
user to work with a specific format. Things like date format should be a
user selection, and we as developers should work with whatever choice the
user has made. I know I'd refuse to use your application if I were forced to
change how I want to input dates. (How you choose to display the dates is a
different matter, but even there you'd be treading on thin ice!)
 
F

forcefield via AccessMonster.com

Looks like the easier way is to format regional short date to dd/mm/yyyy even
though I have originally thought of not changing the regional date setting in
the control panel. Thanks for the tips.
Any other suggestion is still welcome.

Tks

That's as designed if the user's Regional Settings have the Short Date
format set to mm/dd/yyyy.

The only way you can get around this would be to have the field unbound, and
put logic in its AfterUpdate event to interpret the input how you want, and
then pass that value to the actual field in the recordset. You'd also have
to include code in the form's Current event to take the value from the
recordset and write it to the unbound text field.

In my opinion, you're violating a basic rule of programming by forcing the
user to work with a specific format. Things like date format should be a
user selection, and we as developers should work with whatever choice the
user has made. I know I'd refuse to use your application if I were forced to
change how I want to input dates. (How you choose to display the dates is a
different matter, but even there you'd be treading on thin ice!)
Hi Kais,
Format for my text box, Sdate is dd/mm/yyyy and its input mask is
[quoted text clipped - 18 lines]
 
D

Douglas J. Steele

Sounds to me as though you didn't read my advice. You as a developer have no
business changing the user's regional settings. Those are their settings,
and they've likely chosen them for good reason. If you change their
settings, you're impacting every application they run. And don't think "Oh,
I'll just change it when my application starts, and change it back when they
shut down my application", because they may well be multi-tasking and using
other applications at the same time as yours.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


forcefield via AccessMonster.com said:
Looks like the easier way is to format regional short date to dd/mm/yyyy
even
though I have originally thought of not changing the regional date setting
in
the control panel. Thanks for the tips.
Any other suggestion is still welcome.

Tks

That's as designed if the user's Regional Settings have the Short Date
format set to mm/dd/yyyy.

The only way you can get around this would be to have the field unbound,
and
put logic in its AfterUpdate event to interpret the input how you want,
and
then pass that value to the actual field in the recordset. You'd also have
to include code in the form's Current event to take the value from the
recordset and write it to the unbound text field.

In my opinion, you're violating a basic rule of programming by forcing the
user to work with a specific format. Things like date format should be a
user selection, and we as developers should work with whatever choice the
user has made. I know I'd refuse to use your application if I were forced
to
change how I want to input dates. (How you choose to display the dates is
a
different matter, but even there you'd be treading on thin ice!)
Hi Kais,
Format for my text box, Sdate is dd/mm/yyyy and its input mask is
[quoted text clipped - 18 lines]
The format of a field or textbox has nothing to do with an input mask.
Have you tried to use the format dd\/mm\/yy ?
 

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