Well, now that I look at it a bit more closely, you could still have problems
getting an accurate count - depending on your data entry rules.
Example:
Employee: A
obTravelDay: Feb 2 2005
ibTravelDay: Jan 30 2005
With AND If you were looking for travel days in February this record would not
get picked up and if you were looking for travel days in January it would not
get picked up. On the other hand if you were looking for travel in the first
quarter of the year it would get picked up.
Using the original query (with or) the record would get picked up, but you would
have extra days counted in the first two cases above.
The problem lies with the structure. For this problem, your table should be
more like
ID
Employee
TravelDate
InboundOrOutbound
That makes it simple. If you have to use the current structure, I would revise
the process and use a union query to normalize the data and then use that in
your query
SELECT ID, Employee, obTravelDay
FROM TheTable
UNION ALL
SELECT ID, Employee, ibTravelDay
FROM TheTable
Save that as qryTravelDays
Now your query becomes
SELECT ID, Employee,
Abs(Sum(Weekday(ObTravelDay)=1 or WeekDay(ObTravelDay)=7)) as WkEndDays,
Abs(Sum(Weekday(ObTravelDay)>1 and WeekDay(ObTravelDay)<7)) as WkDays
FROM qryTravelDays as Q
WHERE ObTravelDay Between #1/1/05# and #1/31/05#
GROUP BY ID, Employee
You may be able to do this all in one fell swoop by embedding your query.
SELECT Q.ID, Q.Employee,
Abs(Sum(Weekday(Q.ObTravelDay)=1 or WeekDay(Q.ObTravelDay)=7)) as WkEndDays,
Abs(Sum(Weekday(Q.ObTravelDay)>1 and WeekDay(Q.ObTravelDay)<7)) as WkDays
FROM [SELECT ID, Employee, obTravelDay
FROM TheTable
ObTravelDay Between #1/1/05# and #1/31/05#
UNION ALL
SELECT ID, Employee, ibTravelDay
FROM TheTable
ibTravelDay Between #1/1/05# and #1/31/05#]. as Q
WHERE ObTravelDay Between #1/1/05# and #1/31/05#
GROUP BY ID, Employee