Date in field is wrong (1 Viewer)

access2010

Registered User.
Local time
Yesterday, 17:46
Joined
Dec 26, 2009
Messages
1,019
Up until to-day, the date entry was always correct

We use a Macro SendKeys; =Format$(Date(),"yy mmm dd")
Wait; No

The Field Format is; yyyy mmm dd
I also tried the Field Format as; yy mmm dd
Using the macro for either format the entry appears as; 21 Apr 04

When we leave the field the entry appears as; 2004 Apr 21

The Windows 10 date reads; 4/4/2021

Can I please have a suggestion how to fix this problem, which for the FIRST time appeared to-day?

Thank you
Nicole
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 00:46
Joined
Sep 12, 2006
Messages
15,614
Code:
Format$(Date(),"yy mmm dd")

I think that code confuse access sometimes. This should work.

Format$(Date(),"yyyy mmm dd")
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:46
Joined
May 7, 2009
Messages
19,169
i suggest use the Default value of the textbox instead of Macro.

Default Value: =Date()

Format only applies to the field/text Display.
 

access2010

Registered User.
Local time
Yesterday, 17:46
Joined
Dec 26, 2009
Messages
1,019
Thank you both for your assistance, we have decided to use; Format$(Date(),"yyyy mmm dd").
What I do not understand our previous Macro worked for YEARS.

I do appreciate your help.
Nicole

 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 00:46
Joined
Sep 12, 2006
Messages
15,614
if you try to just declare a date in a module

const mydate= #21 Apr 04#
The date changes to #4/21/2004# (which is 2004 Apr 21, as in your original post)

It's trying its best to work out which date you mean from incomplete information
Try different dates to see what happens. Note that this is US date format mm/dd/yyyy
If you are in the UK, it's possibly even less clear what you will end up with.

I am not sure what answers you got previously. Try different date values to see.
 
Last edited:

access2010

Registered User.
Local time
Yesterday, 17:46
Joined
Dec 26, 2009
Messages
1,019
We thank you all for your suggestions.
We have decided to use our macro
=Format$(Date(),"yyyy mmm dd")

Crystal
 

Users who are viewing this thread

Top Bottom