By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,968 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,968 IT Pros & Developers. It's quick & easy.

How to compare two date fields for num of days difference between?

P: 1
I am using Access 2007. I have two date fields (date receievd and date complete). I need to be able to run a query and find out who is not completing their work within two days of receipt. I tried using datediff but can't figure it out. Any thoughts? I would appreciate it!

Chellie
Jul 1 '10 #1
Share this Question
Share on Google+
2 Replies


100+
P: 122
The syntax for DateDiff would be something like this:
Expand|Select|Wrap|Line Numbers
  1. DateDiff("d", [Date Received], [Date Complete])
  2.  
That will give you the difference between the two fields, expressed in days. Add that as a column in your query and you can set whatever criteria you want to filter the results that the query returns.
Jul 1 '10 #2

NeoPa
Expert Mod 15k+
P: 31,769
I would suggest a WHERE clause in your query's SQL of :
Expand|Select|Wrap|Line Numbers
  1. WHERE DateDiff('d',[Date Received],[Date Completed])>2
By the way, please check the spelling of your field names. I very much hope they are not as you have posted them. Generally it is appreciated if you post your question accurately, as this can save wasted time and effort.

Welcome to Bytes!
Jul 1 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.