Solved

Ensure fresh data

Posted on 2013-02-05
10
274 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
 
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now