Subtracting Dates in a Query

J

joshroberts

I have a table that has due dates in the following format, 20060829 for
today. I want to subtract today's date from the due date but I'm having
problems getting Access to recognize the due dates as a date instead of a
number. If I subtract them as numbers it doesn't consider that there are
only 30 days in August. Can you help me out? Thanks.
 
J

John Spencer

What is the field Type? Numeric, DateTime, Text?

Assumption:

FieldType is Not text

Force the date string (or number) into a formatted date string, convert that
to a date, and then use DateDiff to calculate a number of days between the
Date and the datevalue.

DateDiff("d",DateValue(FORMAT([YourField],"@@@@-@@-@@")),Date())
 
Top