Date Function returning wrong date

Spackle

Registered User.
Local time
Today, 19:12
Joined
Jul 12, 2018
Messages
12
I must be missing something basic here.

I'm looking for today's date, but when I run this,

Code:
Msgbox Date

I get yesterday's date.

I've checked that the system date on the computer is definitely correct, so what else could be affecting it? I've already searched for answers, but no luck
 
Do you have a field on the form named Date? You shouldn't name a field that, but you can disambiguate:

MsgBox VBA.Date
 
Last edited:
I am unable to reproduce your problem using both Debug.Print Date and Msgbox Date when in the Immediate Window. (Yes, MsgBox works in the immediate window). Is it always wrong for you? And can you try Now(), perhaps with a FormatDateTime function and the General Date option to see if the time of day is also wrong?

Is there a chance that an Excel App object is in play here? Because Access and Excel use reference dates that differ by one day. So things COULD get confused depending on context.
 

Users who are viewing this thread

Back
Top Bottom