Trouble subtracting dates??

  • Thread starter Thread starter tcek
  • Start date Start date
T

tcek

i am trying to subtract 2 days from today's date as part of a filter query
date()-2

i do not get any results. i have seen that access may not perform this
function as stated. is this true or am i doing something incorrectly?
 
Show us the SQL. Open the query in design view. Next go to View, SQL View
and copy and past it here.

Date()-2 will give you midnight two days ago such as 12/29/2007. If it's in
the criteria, you will need an exact match. If the records have a time
componet, something like 12/29/2007 1:43:40 PM, then those records won't be
returned.

If you are getting error messages, it could be a problem with references.
Date() often is the first function that shows this problem. Go to the
following web page for information on checking references:

http://www.mvps.org/access/bugs/bugs0001.htm
 
i have always thought it to be a date and time function not matching another
date function. how to i only select for date and not the date and time?
 
Best is to use BETWEEN Date() - 1 AND Date() - 2 as the criteria.

An alternative is to use the DateValue function on the field in your table.
 
Back
Top