Calculating Date Difference

vadharah

Registered User.
Local time
Today, 01:52
Joined
Oct 14, 2008
Messages
35
Hi Guys,

I have a table called 'Monitors' one of the colums is a date and i want to return values with dates more than 6 months old.

i have this so far

SELECT *
FROM Monitors
WHERE DateDiff("m", #Date()#,#Household.date#) > 6;

what am i doing wrong here.

Thanx in advance
 
Dates have to be enclosed by ## only if they are non-dates... i.e. hardcoded or text values.

Date() and/or fields that are dates themselves dont need to be enclosed.
SELECT *
FROM Monitors
WHERE DateDiff("m", Date(),Household.date) > 6;
 
Look at "DemoDateAddA2000.mdb" (attachment, zip).
Look at Table, Query1. Run Query1.
Use DateAdd function in query.
 

Attachments

Users who are viewing this thread

Back
Top Bottom