A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date Differences



 
 
Thread Tools Display Modes
  #1  
Old July 9th, 2008, 02:25 PM posted to microsoft.public.access.tablesdbdesign
Peter
external usenet poster
 
Posts: 962
Default Date Differences

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
--
Peter
  #2  
Old July 9th, 2008, 02:50 PM posted to microsoft.public.access.tablesdbdesign
Allen Browne
external usenet poster
 
Posts: 11,706
Default Date Differences

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

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Peter" wrote in message
...
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"


  #3  
Old July 9th, 2008, 02:51 PM posted to microsoft.public.access.tablesdbdesign
Golfinray
external usenet poster
 
Posts: 1,597
Default Date Differences

Try this:
Number I want:datediff("d",[now()],[due date])

"Peter" wrote:

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
--
Peter

  #4  
Old July 10th, 2008, 10:24 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Date Differences

On Wed, 9 Jul 2008 06:51:00 -0700, Golfinray
wrote:

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

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.