Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data type error when using datediff

Status
Not open for further replies.

pvg

IS-IT--Management
Feb 17, 2000
12
US
Database has a transaction date field that is formatted as mmddyyyy. Need to know in an Access 2000 Query how to test if the date is greater than today or older than 4 months. I tried using the datediff expression ie: datediff("d",([transdate]),date()) which returns a number that is greater than 1 or minus. In the critera field I put < -120 or > 1. Running the program causes a data type error, however, If you leave out the criteria, the program shows the column in the query.
 
Shouldn't your criteria be like &lt;-1 cause the difference is negative for future dates? And respectively &gt;120 for older than 4 months. I also use now() function in DateDiff to find out the present date.<br>
DiffInDays: DateDiff(&quot;d&quot;;[transdate];Now())<br>
<br>
Al
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top