Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very easy I suspect but driving me nuts--DateDiff 1

Status
Not open for further replies.

CEF2007

Technical User
Jan 24, 2007
2
US
Running access 2003 and want to have field value (3) produce the result (in days) between field dates 1 and field dates 2.

The expression I've used is:

=DateDiff("d",[field1],[field2])

All I get in field 3 is zero. I've tried different variations of the above expression such as "d", or no "'s or 's

What am I doing wrong?
 
you'd be better off posting this in one of the Access specific forums:

Forum701
Forum700
Forum181

but you can also, if the fields in the table are dates, just use:

=StartDateField - EndDateField



Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Make sure the data fields are exactly the same that you are comparing. Do not know too much about the dates in Access.

Here is an example I was looking at:

=DateDiff("m", #12/24/2000#, #11/26/2000#)

The first date should be the earlier date or evaluates to -1, so the results need to have a range that allows for negatives.

If you do not like my post feel free to point out your opinion or my errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top