View Full Version : DateAdd #error


JimmyJazz
04-30-2004, 05:20 AM
Does anyone have a clue why the following isn't working?

I have an Access report text box, that I want to display a certain date value - 1 day, using the following control source:
=DateAdd("d";-1;[newdate])
that just displays #error when printed.

If I substitute with a static date, such as:
=DateAdd("d";-1;#2004-04-30#)
it works fine.

If I use the same in an sql query, such as:
SELECT DateAdd("d", -1, [newdate]) FROM test
it also works fine.

"newdate" is a standard Date/Time field, and the values entered are in the format according to my regional settings (ie yyyy-mm-dd).

Also, I wonder why I get a syntax error message when I try to use the "standard" syntax for dateAdd in control source, such as:
=DateAdd("d", -1, [newdate])
Instead I have to enter it like:
=DateAdd("d";-1;[newdate])

Are there different syntax rules in Access 2002, than in previous versions, or is something else wrong here?

Any hints would be VERY appreciated!

Mile-O
04-30-2004, 06:01 AM
Try:

=DateAdd("d";-1;CDate([newdate]))