J
jutlaux
What I am trying to do is take a time field from 1 query and put a window
around it and from another query look up an alarm event within that time
frame based on a specific event on a specific day on a specific machine in 1
of the 2 underlying queries. I have gotten this to work when on the
specified machine and day the event in question only happens once. The
problem I have is that if the event happens more then once on the same day
the query returns nothing. I apologize for the long post, but wanted to
explain all that that I have to better assist with answers.
My question is two fold 1) Is this the best way to do this? 2) If o then
what can I do to get the data when the event happens more then once on the
same day.
Thanks!
I have 1 query (qryAlarmsMaster) that is used to join 2 queries
(qryAlarmShutdown & qryPRESS_ALARM_HISTORY).
qryAlarmShutdown is the query that has the event that I am looking for, the
specific date of the event, and time that I am trying to window around.
Within this query I have created a =/- 10 minute window with the following
statement
Time_Window1:
DateAdd("n",10,TimeSerial(Hour([CURE_START_DATE_TIME]),Minute([CURE_START_DATE_TIME]),Second([CURE_START_DATE_TIME])))
Time_Window2:
DateAdd("n",-10,TimeSerial(Hour([CURE_START_DATE_TIME]),Minute([CURE_START_DATE_TIME]),Second([CURE_START_DATE_TIME])))
both these windows are giving me the right info.
qryPRESS_ALARM_HISTORY has a field [Alarm_Start_Time2], which is the time
fram I am windowing around
In qryAlarmsMaster I have 2 fields that are joined together
qryAlarmShutdown.Cure_Start_Date is joined to
qryPRESS_ALARM_HISTORY.Alarm_Start_Date and
qryAlarmShutdown.PRESS_NAME is joined to qryPRESS_ALARM_HISTORY.PRESS_NAME
In qryAlarmsMaster I have 5 fields: [Cure_Start_Date], [PRESS_NAME],
[SHUTDOWN_ALARM_COND], [Alarm_Start_Time2], & [ALARM_NUMBER]
[Cure_Start_Date] -> specified day of the event
[PRESS_NAME] -> specific machine
[SHUTDOWN_ALARM_COND] -> specific events
[Alarm_Start_Time2] -> Window time frame
[ALARM_NUMBER] -> looked up alarm event
What I do to run this query is in the criteria section I type in a date for
[Cure_Start_Date], a value for [PRESS_NAME], [SHUTDOWN_ALARM_COND] , and for
[Alarm_Start_Time2] I have Between [Time_Window1] And [Time_Window2]
I have passed the SQL to maybe help out.
SELECT qryAlarmShutdown.Cure_Start_Date, qryAlarmShutdown.PRESS_NAME,
qryAlarmShutdown.SHUTDOWN_ALARM_COND,
qryPRESS_ALARM_HISTORY.Alarm_Start_Time2, qryPRESS_ALARM_HISTORY.ALARM_NUMBER
FROM qryAlarmShutdown LEFT JOIN qryPRESS_ALARM_HISTORY ON
(qryAlarmShutdown.PRESS_NAME = qryPRESS_ALARM_HISTORY.PRESS_NAME) AND
(qryAlarmShutdown.Cure_Start_Date = qryPRESS_ALARM_HISTORY.Alarm_Start_Date)
WHERE (((qryAlarmShutdown.Cure_Start_Date)=#1/14/2009#) AND
((qryAlarmShutdown.PRESS_NAME)="V14") AND
((qryAlarmShutdown.SHUTDOWN_ALARM_COND)=3 Or
(qryAlarmShutdown.SHUTDOWN_ALARM_COND)=11 Or
(qryAlarmShutdown.SHUTDOWN_ALARM_COND)=63 Or
(qryAlarmShutdown.SHUTDOWN_ALARM_COND)=64) AND
((qryPRESS_ALARM_HISTORY.Alarm_Start_Time2) Between [Time_Window1] And
[Time_Window2]));
around it and from another query look up an alarm event within that time
frame based on a specific event on a specific day on a specific machine in 1
of the 2 underlying queries. I have gotten this to work when on the
specified machine and day the event in question only happens once. The
problem I have is that if the event happens more then once on the same day
the query returns nothing. I apologize for the long post, but wanted to
explain all that that I have to better assist with answers.
My question is two fold 1) Is this the best way to do this? 2) If o then
what can I do to get the data when the event happens more then once on the
same day.
Thanks!
I have 1 query (qryAlarmsMaster) that is used to join 2 queries
(qryAlarmShutdown & qryPRESS_ALARM_HISTORY).
qryAlarmShutdown is the query that has the event that I am looking for, the
specific date of the event, and time that I am trying to window around.
Within this query I have created a =/- 10 minute window with the following
statement
Time_Window1:
DateAdd("n",10,TimeSerial(Hour([CURE_START_DATE_TIME]),Minute([CURE_START_DATE_TIME]),Second([CURE_START_DATE_TIME])))
Time_Window2:
DateAdd("n",-10,TimeSerial(Hour([CURE_START_DATE_TIME]),Minute([CURE_START_DATE_TIME]),Second([CURE_START_DATE_TIME])))
both these windows are giving me the right info.
qryPRESS_ALARM_HISTORY has a field [Alarm_Start_Time2], which is the time
fram I am windowing around
In qryAlarmsMaster I have 2 fields that are joined together
qryAlarmShutdown.Cure_Start_Date is joined to
qryPRESS_ALARM_HISTORY.Alarm_Start_Date and
qryAlarmShutdown.PRESS_NAME is joined to qryPRESS_ALARM_HISTORY.PRESS_NAME
In qryAlarmsMaster I have 5 fields: [Cure_Start_Date], [PRESS_NAME],
[SHUTDOWN_ALARM_COND], [Alarm_Start_Time2], & [ALARM_NUMBER]
[Cure_Start_Date] -> specified day of the event
[PRESS_NAME] -> specific machine
[SHUTDOWN_ALARM_COND] -> specific events
[Alarm_Start_Time2] -> Window time frame
[ALARM_NUMBER] -> looked up alarm event
What I do to run this query is in the criteria section I type in a date for
[Cure_Start_Date], a value for [PRESS_NAME], [SHUTDOWN_ALARM_COND] , and for
[Alarm_Start_Time2] I have Between [Time_Window1] And [Time_Window2]
I have passed the SQL to maybe help out.
SELECT qryAlarmShutdown.Cure_Start_Date, qryAlarmShutdown.PRESS_NAME,
qryAlarmShutdown.SHUTDOWN_ALARM_COND,
qryPRESS_ALARM_HISTORY.Alarm_Start_Time2, qryPRESS_ALARM_HISTORY.ALARM_NUMBER
FROM qryAlarmShutdown LEFT JOIN qryPRESS_ALARM_HISTORY ON
(qryAlarmShutdown.PRESS_NAME = qryPRESS_ALARM_HISTORY.PRESS_NAME) AND
(qryAlarmShutdown.Cure_Start_Date = qryPRESS_ALARM_HISTORY.Alarm_Start_Date)
WHERE (((qryAlarmShutdown.Cure_Start_Date)=#1/14/2009#) AND
((qryAlarmShutdown.PRESS_NAME)="V14") AND
((qryAlarmShutdown.SHUTDOWN_ALARM_COND)=3 Or
(qryAlarmShutdown.SHUTDOWN_ALARM_COND)=11 Or
(qryAlarmShutdown.SHUTDOWN_ALARM_COND)=63 Or
(qryAlarmShutdown.SHUTDOWN_ALARM_COND)=64) AND
((qryPRESS_ALARM_HISTORY.Alarm_Start_Time2) Between [Time_Window1] And
[Time_Window2]));