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

How can I use DateDiff-function in MS Access SQL?

Status
Not open for further replies.

123451238

Technical User
Nov 16, 2004
2
NO
I have tried to use the DateDiff-function to determine how many months there between today and the day a contract is signed.

In the query, I write the following:

DateDiff(month;Now();SignedDate)

MS Access 2003 won't accept eithter "month" nor "m" as the first attribute. Is there a way to make this function work or perhaps an even better way to solve this problem?

OL
 
DateDiff("d", Now, TheDate)


Sam_F
"90% of the problem is asking the right question.
 
Do understand that DateDiff() will return the number of date/time interval boundaries are crossed. For instance:
DateDiff("m",#11/30/2004#,#12/1/2004#)
DateDiff("m",#11/1/2004#,#12/31/2004#)
result in 1 for both expressions. However, change to
DateDiff("d",#11/30/2004#,#12/1/2004#)
DateDiff("d",#11/1/2004#,#12/31/2004#)
and get answers of 1 and 60.


Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top