?
Solved

Ensure fresh data

Posted on 2013-02-05
10
Medium Priority
?
323 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 40

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 48

Accepted Solution

by:
Dale Fye earned 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
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…

752 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