M
Mark
Hello all,
I want to run queries for a particular shift over a variable data range.
Select * from MyTable
Where MyDate between 07/01/06 and 07/08/06
A shift time is on Monday, Tuesday, Wednesday from 6:00 AM to 600 PM
B shift time is on Thursday, Friday, Saturday from 6:00 AM to 600 PM
etc..
The shifts work 3 days a week. So if the data range was over 2 weeks then I
would need to run the query 6 times to get all my data. Is there a way to
get this with either looping, or some function that access has? What would
be the best way to approach this?
One way I can think of is creating a table (below) with the Shift, start
time, end time, and day. Then loop thru it until I get all the data range.
Help me with the best approach.
Examples:
VCnt = 0
Do
VCnt = Vcnt + 1
VSql = “My SQL statement with the variable between statementâ€
docmd.runSql(vsql)
Loop while vCnt <= vCnt1
MyShiftTable
Shift StartTime EndTime Day
A 06:00:00 17:59:00 Monday
A 06:00:00 17:59:00 Tuesday
A 06:00:00 17:59:00 Wednesday
B 06:00:00 17:59:00 Thursday
B 06:00:00 17:59:00 Friday
B 06:00:00 17:59:00 Saturday
C 18:00:00 05:99:00 Monday
Etc..
I want to run queries for a particular shift over a variable data range.
Select * from MyTable
Where MyDate between 07/01/06 and 07/08/06
A shift time is on Monday, Tuesday, Wednesday from 6:00 AM to 600 PM
B shift time is on Thursday, Friday, Saturday from 6:00 AM to 600 PM
etc..
The shifts work 3 days a week. So if the data range was over 2 weeks then I
would need to run the query 6 times to get all my data. Is there a way to
get this with either looping, or some function that access has? What would
be the best way to approach this?
One way I can think of is creating a table (below) with the Shift, start
time, end time, and day. Then loop thru it until I get all the data range.
Help me with the best approach.
Examples:
VCnt = 0
Do
VCnt = Vcnt + 1
VSql = “My SQL statement with the variable between statementâ€
docmd.runSql(vsql)
Loop while vCnt <= vCnt1
MyShiftTable
Shift StartTime EndTime Day
A 06:00:00 17:59:00 Monday
A 06:00:00 17:59:00 Tuesday
A 06:00:00 17:59:00 Wednesday
B 06:00:00 17:59:00 Thursday
B 06:00:00 17:59:00 Friday
B 06:00:00 17:59:00 Saturday
C 18:00:00 05:99:00 Monday
Etc..