Link to home
Start Free TrialLog in
Avatar of Senniger1
Senniger1

asked on

Access Date Format using Dot or Period as Separator

We have Office 2010.  In Access 2010, I have a table named Docket.  In this table I have a field called DktDate.

The field DktDate is formatted as a Short Date.  I created a Form named frmDocket.

When I enter dates into the DktDate field of this form...
   I can type 11/21/2013 and it displays as 11/21/2013 - This is perfect.
   I can type 11/21/13 and it displays as 11/21/2013 - This is perfect.
   I can type 11.21.2013 and it displays as 11/21/2013 - This is perfect.
   I can type 11.21.13 and it displays as 12/30/1899 - This is a major issue!

I need my users to also be able to type 11.21.13 and I need it to display 11/21/2013.

Can anyone assist me with this?  

Also, I don't want to have to alter my settings under the Windows Regional and Language Options.

Thanks in advance!
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

you can do this by adding an unbound textbox to your form "txtDate"

in the afterupdate of this textbox, set the value of your DktDate

me.DktDate=replace(me.txtDate,".","/")
Avatar of Senniger1
Senniger1

ASKER

capricorn1 - I always appreciate your help.

I want to mention I simplified my form so everyone could understand my question.  My actual form has at least 50 date fields.

With that being said, what field are you proposing the user enters the date into?  The DktDate field or the txtDate field.  And if it's the latter, will it still format all the other entry variations (listed above) correctly?

Thanks!
<And if it's the latter, will it still format all the other entry variations (listed above) correctly?>

Yes

better using the cdate() function

me.DktDate=cdate(replace(me.txtDate,".","/") )
So sorry.  I'm still confused.  

Will the user be entering the date in the DktDate field on the form or on the txtDate field on the form?
the date will entered in txtDate,

in the afterupdate of this textbox, set the value of your DktDate

me.DktDate=cdate(replace(me.txtDate,".","/") )
Okay, I see that logic works, however I'm concerned with my form.  If I have to add an unbound textbox for every date field I have on my form then I will have two fields showing for every field.  

My form is quite involved with 50+ dates on it and barely has room for all the fields already on it.  Also I think it would be quite confusing to see to date fields for each item on the form.

Am I missing something?
you don't need to show the bound controls for dates in your form,
just  show the unbound controls

you can place the unbound textboxes on top of the bound controls
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This was exactly what I needed.  Thanks to everyone for your help!
You are welcome!

/gustav