tia97
tia97

Reputation: 350

Calculating days between today and a date field in an Access table

Hi I'm trying to calculate the number of days between a date field in my current access table and todays date. Here is what I have:

DAYS ON REPORT: DateDiff("d",[REPORTDATE],[DATE()])

The problem I am having is when I run the query I get a pop up box asking for "Date()"

I am trying to avoid adding a column for "today" and then doing the days between that column and the reportdate column if possible.

REPORTDATE is a column already existing in my table.
DAYS ON REPORT is the field/column I am creating.

Upvotes: 0

Views: 16632

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123829

When not enclosed in square brackets, Date() is a function call that returns the current system date. Putting square brackets around it turns it into a field name. Since there is no field with that name, the query treats it as a parameter and prompts for its value.

Solution: Get rid of the square brackets.

Upvotes: 3

Related Questions