Subtracting Dates in a Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top