Date Differences

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi I'm a novice on this one. If I want to have a field calculating the
differences between two date fields I enter the expression in "field
properties" under "default value". Am I correct so far? then I create the
expression. The data entry fields are "Today" and "DueDate" and one shot at
the expression to calculate the "Countdown" field was =[Today]-[DueDate], I
also tried =DateDiff ("d",[Today],[DueDate]) and other versions all to no
avail. The error message I get on saving is "The Database Engine does not
recognise either the field "Today" in a valid expression or the default value
in the table HSEQ control table"

Help please, thanks
 
Use Date() rather than Today in Access.

But the expression goes into the Control Source, not the Default Value:
=Date() - [DueDate]

You should not have a field in your table to store this. Since it changes
every day, it is something that should be calculated when needed. More info
in:
Calculated Fields
at:
http://allenbrowne.com/casu-14.html
 
Try this:
Number I want:datediff("d",[now()],[due date])

Actually leave off the brackets around Now() - otherwise Access will assume
you have a field named Now() and complain.
 
Back
Top