Date Differences

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
 
A

Allen Browne

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
 
J

John W. Vinson

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.
 

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

Top