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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

big trouble with date calculations......

Status
Not open for further replies.

NeilBelgium

IS-IT--Management
Sep 18, 2001
87
BE
I've created several tables with short date as the type, and am trying to run queries that make calculations from these dates.

Have tried using now (), date (), but keep getting syntax and other errors.

How DO you calculate the following:

The difference between two dates, eg 4/1/2002 and 10/1/2002 (the non-american way round!). The answer should be six days, but how can it be achieved?

Also, how filter records that have a date either before today (<?) or after today (>?)

this is causing me no end of trouble,n and all help gratefully accepted!!

thanks, neil
 
Here are a couple of Access functions you can use.

Debug.Print DateDiff(&quot;y&quot;, #1/4/2002#, #1/10/2002#)
Debug.Print DateAdd(&quot;d&quot;, -1, #2/1/2002#)

Run these then do a Control G and you will see how they work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top