Date Function returning wrong date (1 Viewer)

Spackle

Registered User.
Local time
Today, 23:30
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
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:30
Joined
Aug 30, 2003
Messages
36,131
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:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 08:30
Joined
Feb 28, 2001
Messages
27,122
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

Top Bottom