Solved

Ensure fresh data

Posted on 2013-02-05
10
300 Views
Last Modified: 2013-02-07
I have table "TIger" that every minute imports new records from a .csv file.

I would like to test the data to ensure that it is current (within the last 30 minutes) based on fields "obs_date" and "obs_time", which are a medium time, and short date field (respectively).

If the data is older than 15 minutes, I would like to pop up a message box that states: "Reset link software immediately".

added bonus: The message box should close after 5 minutes if not acknowledged; that way if the software gets reset while I'm not at the database computer, we can continue processing.

If the solution involves vba, please include at the bottom how to call it from a macro.  I will be running the macro every few minutes.

Thank you!
0
Comment
Question by:TIgerV
10 Comments
 
LVL 39

Expert Comment

by:als315
ID: 38858138
Where are your fieds ("obs_date" and "obs_time")? In database or in csv? If in csv, upload sample file.
0
 

Author Comment

by:TIgerV
ID: 38858842
In the database.  Imported to the table.
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38858977
Assuming this data is going to some sort of staging table, I would add some code similar to the following to your upload process, immediately after the upload.
Dim strCriteria as string

strCriteria = "DateValue([Obs_Date]) + timeValue([ObsTime]) < #" & DateAdd("n", -15, Now()) & "#"
if DCount("Obs_Date", "staging table", strCriteria) > 0 then
    
     DoCmd.Openform "frmWarning",,,,,acDialog

EndIf 

Open in new window

Note, you cannot use a MsgBox command to display your message as there is no way to programmatically close a messagebox.  Instead, create your own form (frmWarning) which has a TimerInterval of 300000 (5 minutes) and has Timer event code that will close the form after 5 minutes.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38859970
Why not just "Link" to the CSV file...

Then you won't have to bother with all the overhead of "Importing" the file over and over and over...

Then you can set the refresh rate in conjunction with perhaps re querying the form.

JeffCoachman
0
 

Author Comment

by:TIgerV
ID: 38861916
The file is refreshed with new data every minute.  I'm trying to collect that data every few minutes to get a sample over time.

5:38p,02/06/13,31.6,31.2,27.6, 73,30.303,Steady,5.2,SSE, 5.2, 5.2, 5.4, 9

It's time, date, temperature values (x4), pressure, flow speed, flow direction and then 3 values for high flow over 1, 2, 5 and 10 minutes.

I want to capture that data occasionally, and maintain a log that watches for certain values to be out of tollerance.  Importing and adding a line every few minutes is pretty easy and allows me to go back and see if we missed a time that temperatures/flow were out of tollerance.

So, I need to take the 5:38p temperature (31.6c) and compare it to the highest flow speed over 10 minutes (9ips).  If the temp is high, the flow can be faster, if the temp is low, the flow must be slower or it cools to fast.

Sometimes, the floor calls and says "Yesterday's batch was too cold"; and I can go back and look at the values presented to see where/when the problem was, or if they just sat on it too long.

I combine this with the output of our other monitoring system, as well, to ensure we're getting the same values and nothing is out of tune.

On occasion, the software running the sensors malfunctions, and I need to restart it.  Right now, there is no way to tell if it failed unless i come in. End result here is that I will just send a restart command if the import fails, but a text box for now is good.
0
 

Author Comment

by:TIgerV
ID: 38861933
The reason I have the 1, 2, 5, 10 minute history is because when the software restarts, it 0s out those values and the system would alarm on 0, so I take the lowest of the values above '0' for my sample if a data point is missing.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38862487
Did you read my suggestion about linking to the CSV file?


I seem to be confused, ...what is your one question here...?
How to refresh the data or creating "Historical" snapshots of the data.

JeffCoachman
0
 

Author Comment

by:TIgerV
ID: 38862497
My question was about checking dAte and time....
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38862524
0
 

Author Closing Comment

by:TIgerV
ID: 38863701
Thank You!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My experience with Windows 10 over a one year period and suggestions for smooth operation
Outlook Free & Paid Tools
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question