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

query a date range 1

Status
Not open for further replies.

gol4

Technical User
Apr 4, 2000
1,174
US
I posted this question last week and did not get a solution so I am reposting.

I have a database used to track attendance
The table uses occurstart to hold the date they first missed and occurreturn for the date they returned.
Example
empid Occurstart Occurreturn
123 6/1/2001 6/2/2001 all days in June
345 6/29/2001 7/3/2001 2 days in June
234 5/28/2001 6/3/2001 3 days in June
654 5/29/2001 7/1/2001 30 days in June

using SQL how can I capture all employees that missed days in June

I will appreciate any advice received
 
gol4:

Set up your where condition as such:

WHERE (((tblTableName.OccurStart)<=#6/30/01#) AND ((tblTableName.OccurReturn)>=#6/1/01#));

This should capture any record where any of the missed dates where sometime in the month of June.
Larry De Laruelle
larry1de@yahoo.com

 
Thanks Larry, I tried several combinations of between and such. After seeing the solution I feel pretty stupid.
 
gol4:

Been there, done that.

It seems to be a human condition to try to make things more complicated than they need to be.

By the way, if you don't already do it, a great way to create SQL code is to create a query in design view to test and then go to SQL view and copy the code to your event procedures.

Saves a lot of time debugging bad syntax.
Larry De Laruelle
larry1de@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top