Full Version: Find records from date criteria
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
famico78
I am looking to create a list of all the services in June which have been cancelled 14 days after the startdate of a service and up to 30 days before the startdatedate of the service.

I have a 'startdate', 'enddate' and 'cancellationdate' fiieds.

Please help
Doug Steele
SELECT Field1, Field2, Field3
FROM MyTable
WHERE DateDiff("d", [StartDate], [CancellationDate]) BETWEEN 14 AND 30
famico78
So the above will give me those that have been cancelled up to 14 days after the start date
AND
Those up to 30 days before the start date?
Doug Steele
Sorry, no. I misread your criteria. Try:

SELECT Field1, Field2, Field3
FROM MyTable
WHERE DateDiff("d", [StartDate], [CancellationDate]) BETWEEN -30 AND 14
famico78
Seems to work well, thanks.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.