Trouble with Dates

  • Thread starter Thread starter anupam
  • Start date Start date
A

anupam

Guest
I want to create a parameter query,where the user will enter the date and the query will return records for the past 4 months from that date

Here is the SQL I have written but the results doesn't match

PARAMETERS ReportDate DateTime;
SELECT ExternalTicketsResolved.*, ExternalTicketsResolved.[Date Created], ExternalTicketsResolved.ID
FROM ExternalTicketsResolved
WHERE ((ExternalTicketsResolved.[Date Created])>([ReportDate]-4))
ORDER BY ExternalTicketsResolved.ID;

waiting for a quick response.
 
I think what you might be looking for is the DateAdd function.
Your query would subtract 4 days from the [ReportDate]

Instead of [ReportDate]-4 try DateAdd("m",-4,[ReportDate])

I reckon that will give you what you need.
 

Users who are viewing this thread

Back
Top Bottom