Dim Date gives me 12/31/1899

mrrayj60

Registered User.
Local time
Today, 16:20
Joined
Sep 3, 2009
Messages
103
On an after update I want to replace a date field (mmddyyyy) and I found this in the help, but this gives me a 12/30/1899 date. Its suppose to be my system date. Any help?Thanks, Ray :confused:Dim MyDateMyDate = Date ' MyDate contains the current system date.
 
Date returns the current System Date, not to be confused with the data type Date:)

The following will show a message box with the current system date.
Code:
Dim myDate As Date ' declare a local variable of the Date data type
myDate = Date ' assign the current date to the variable
MsgBox myDate 'show in a message box
 
Thanks, this is what that code gives me...?

Dim myDate As Date ' declare a local variable of the Date data type
*myDate = Date ' assign the current date to the variable
MsgBox myDate 'show in a message box

*error invalid use of null
 
2003 access, I've used date() in append qry before and that works but not in a form afterupdate. I'll check out steeles link and see what that does for me. Thanks for the replies.
Ray
 
the date you are getting is the value of date 0

the date is actually the number of days elapsed since day0, or dec 30, 1899


when you say

mydate = date

the compiler should show you

mydate = date()

if it doesnt put date() , with parentheses it indicates a problem - you may already have a variable, or a field on a form called date, and your app is using this instead of the date function. this is why we try to avoid using reserved words as field names.
 
you got it gemma, I had a field called date, changed and all works like a charm, good tip..Thanks alot.
Ray
 

Users who are viewing this thread

Back
Top Bottom