Full Version: query on a date range not working
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
wilwere
Hi,

I am a newbie to databases in general. I am trying to create a query that will select all records that that have been received (date) and reviewed (date) in less than 5 days. When the following query is run, a pop-up box comes up asking me for the DAY. Can anyone help? Thanks.

(SELECT [record] FROM [table] WHERE DATEDIFF (Day, DateReceived, DateReviewed)< 5
freakazeud
Hi,
welcome to UA forums.
The interval argument part would be "d" and not Day!
But...don't use this in the criteria...instead set up a new expression in query design view e.g.:

DateDifference: DateDiff("d",[DateReceived],[DateReviewed])

Then use this expressions criteria area to filter out what you want e.g.:

< 5

HTH
Good luck
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.