Access 2003-Date() = 12/30/1899 not 06/15/2009 why?

K

KevinSmith

I am trying to write the current data into a record field that is in work in
a form and I get 12/30/1899 instead of the current date, 06/15/2009. I'm
using a macro that is triggered by the a previous action. The macro uses
SetValue with the "item" = [form]![ChangeRequest]![InitiationDate]; and the
"expression" = [form]![ChangeRequest]![InitiationDate] = date().
 
D

Douglas J. Steele

[form]![ChangeRequest]![InitiationDate] = date() is a boolean expression
that will return 0 if the date being displayed in the text box isn't equal
to today's date, or -1 if it is.

Assuming you're trying to set the value of the text box to today's date,
just put =Date() as the expression: you've already told it what to do with
the value as the item.
 
K

KevinSmith

Thanks, it worked.

Douglas J. Steele said:
[form]![ChangeRequest]![InitiationDate] = date() is a boolean expression
that will return 0 if the date being displayed in the text box isn't equal
to today's date, or -1 if it is.

Assuming you're trying to set the value of the text box to today's date,
just put =Date() as the expression: you've already told it what to do with
the value as the item.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


KevinSmith said:
I am trying to write the current data into a record field that is in work
in
a form and I get 12/30/1899 instead of the current date, 06/15/2009. I'm
using a macro that is triggered by the a previous action. The macro uses
SetValue with the "item" = [form]![ChangeRequest]![InitiationDate]; and
the
"expression" = [form]![ChangeRequest]![InitiationDate] = date().
 
M

Marshall Barton

KevinSmith said:
I am trying to write the current data into a record field that is in work in
a form and I get 12/30/1899 instead of the current date, 06/15/2009. I'm
using a macro that is triggered by the a previous action. The macro uses
SetValue with the "item" = [form]![ChangeRequest]![InitiationDate]; and the
"expression" = [form]![ChangeRequest]![InitiationDate] = date().


I never use macros so I can't guarantee anything, but I'm
pretty sure the expression should be just:
Date()

The expression you posted compares the InitiationDate to
Date and because they are not equal, the result is False
(which has the value 0). In Access the date 0 is
12/30/1899.
 

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