Help with this query, please

jtbrown1955

Registered User.
Local time
Today, 01:08
Joined
May 28, 2005
Messages
17
I want to pull a report that shows units that are down in a specific time frame AND units that are already down outside that time frame IF the TimeOn field is null. Below is how the query is set up. It is pulling any nulls outside the time frame (which is what I want) but it is also pulling ALL nulls outside the time frame (which is what I do not want). In other words, I want units that are down and back on inside the specified time AND units that are still down no matter how long. Please help. Thank you.

SELECT DowntimeLog.Area, DowntimeLog.UnitName, DowntimeLog.TimeDown, DowntimeLog.TimeOn, DowntimeLog.Operator, DowntimeLog.Notes, DowntimeLog.Reason, DowntimeLog.TimeArrived
FROM DowntimeLog
WHERE (((DowntimeLog.Area) Like "BGS") AND ((DowntimeLog.TimeDown) Between [Type the beginning date and time:] And [Type the ending date and time:])) OR (((DowntimeLog.Area) Like "BGS") AND ((DowntimeLog.TimeOn) Is Null))
ORDER BY DowntimeLog.TimeDown;
 
If you want to pull records that go down within a time period then thats all you need to check for, however if you want to pull records that show down time during a time period then you have 3 conditions to check for

1 Down time between start and end
or
2 ontime between start and end
or
3 down time <= start and ontime >=end or is null

Brian
 
Last edited:
OK, how do I write that out?
 

Users who are viewing this thread

Back
Top Bottom