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

Query of dates

Status
Not open for further replies.

SirLaugha1ot

Programmer
Oct 14, 2001
9
US
I have two fields - DateReceived and DateCompleted which are in mm/dd/yyyy format.

I'm trying to figure out how to create 3 queries - one that tells me when DateReceived and DateCompleted were within the same day, one that tells me when DateReceived was 1 day before DateCompleted and a third that tells me when DateReceived is 2+ days before DateCompleted.

My main problem are the queries to show me same day and previous day. I've tried Count(([DateCompleted]-[DateFaxed])) where it equals 0 and 1, respectively. Zero pulls up nothing while 1 pulls up both same day and 1 day.

I've about lost my mind trying to figure this one out. Help?? [sadeyes]
 
I would create one query and add another column using the DateDiff function. This will give you the difference between the two dates in days as a seperate column. You can then base whatever subqueries you like on this query, using simple number logic as the criteria.

HTH

Nigel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top