Strange Date

  • Thread starter gchichester via AccessMonster.com
  • Start date
G

gchichester via AccessMonster.com

Any idea why this short script would display just the time?

Private Sub DispatchHeaderPort_GotFocus()
Dim SDate As Date
MsgBox SDate
End Sub

Please see screenshot in my Gallery

Thanks
Gil
 
J

Jon Lewis

Because Dim SDate As Date is preparing some space in memory for some data of
the type Date, but you are not actually supplying the data.

You need:
Dim SDate As Date
SDate = Date
MsgBox SDate

or just

MsgBox Date

HTH
 
G

gchichester via AccessMonster.com

Jon,

Thanks for pointing out the obvious.
My bad for not including the value from a field on my form.
Gil

Jon said:
Because Dim SDate As Date is preparing some space in memory for some data of
the type Date, but you are not actually supplying the data.

You need:
Dim SDate As Date
SDate = Date
MsgBox SDate

or just

MsgBox Date

HTH
Any idea why this short script would display just the time?
[quoted text clipped - 7 lines]
Thanks
Gil
 

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

Top