mfaqueiroz
Registered User.
- Local time
- Today, 11:34
- Joined
- Sep 30, 2015
- Messages
- 125
Hi Everyone!
I have an input tab with many registers with different satatus from machines (on,off,alarm,error...).
I need one virtual query(Tab_Alarm), builded from my input table "Tab", where I want to see all the events 4 seconds before with the status "Alarm". However in case that it finds the status "On" the query should stop.
For exemple:
10:10:16 Alarm
10:10:17 Alarm
10:10:17 Alarm
10:10:18 On
10:10:19 Alarm
10:10:19 Off
10:10:19 Error
10:10:20 My analysed register
The event ot 10:10:17 is 4 seconds before my register, however i have one event with the satus "ON" after that, so I should stop the query on 10:10:19.
There is my code:
MyCurrentDate= !Me.Date.Fields().Value
Date4= DateAdd("s",-4,MyCurrentDate)
Set TAB_Alarm = dbs.OpenRecordset("SELECT Tab.ID, Tab.[My date], Tab.[ms], Tab.Status WHERE (((Tab.[Rtu date])<=#" &Date4 & "#) AND (((Tab.[Rtu date])>=#" & MyCurrentDate & "#))) And TabInst.[Status] = 'ALARM', DB_OPEN_DYNASET)
That gives me all the Alarms 4 seconds before and don't stop when finds one "ON"
Could you please help me adding the condiction:
if finds one "ON" then stop?
I really appreciate your help, thank you!
I have an input tab with many registers with different satatus from machines (on,off,alarm,error...).
I need one virtual query(Tab_Alarm), builded from my input table "Tab", where I want to see all the events 4 seconds before with the status "Alarm". However in case that it finds the status "On" the query should stop.
For exemple:
10:10:16 Alarm
10:10:17 Alarm
10:10:17 Alarm
10:10:18 On
10:10:19 Alarm
10:10:19 Off
10:10:19 Error
10:10:20 My analysed register
The event ot 10:10:17 is 4 seconds before my register, however i have one event with the satus "ON" after that, so I should stop the query on 10:10:19.
There is my code:
MyCurrentDate= !Me.Date.Fields().Value
Date4= DateAdd("s",-4,MyCurrentDate)
Set TAB_Alarm = dbs.OpenRecordset("SELECT Tab.ID, Tab.[My date], Tab.[ms], Tab.Status WHERE (((Tab.[Rtu date])<=#" &Date4 & "#) AND (((Tab.[Rtu date])>=#" & MyCurrentDate & "#))) And TabInst.[Status] = 'ALARM', DB_OPEN_DYNASET)
That gives me all the Alarms 4 seconds before and don't stop when finds one "ON"
Could you please help me adding the condiction:
if finds one "ON" then stop?
I really appreciate your help, thank you!