DateAdd / Comparison A97 Problem

Forrest

Registered User.
Local time
Today, 15:54
Joined
Feb 12, 2007
Messages
14
I'm running a query to find records over one year old. When I use Date()-"365" or DateAdd (365 days, 12 months, 4 quarters, or 1 year) the records from one year ago today come up just like they are suppose to. The problem comes in when I put the comparison operator out front.

If I put < in front of either Date() or DateAdd minus one year, I get all records from yesterday and earlier as if it is ignoring the year and only looking at the month and day. If I put > in front, I get today's records.

Date() and DateAdd by themselves are working as advertised. Things only get weird when I put < or > out front.

What am I doing wrong?

Thanks,
Forrest
 
Create an extra field in your query:
Code:
DDIF:DateDiff("y",[YourDateField],Date())
and in the criteria put:

>1
 
Bob, I made a rookie mistake. I had my date formatted as text in my table instead of short date. When I made that change, funny, everything started working correctly. I figured I was doing something not so bright and as it turns out, I was. Thanks for the help.
Forrest
 

Users who are viewing this thread

Back
Top Bottom