Hi all,
Is it possible to show records that happen a specific amount of time after a filtered record?
For example: If I was to filter a table of alarms by a keyword, could I show any records that happen 15 mins for example straight after?
This is show whether the subsequent alarms are related to the original filtered alarm.
Thanks in advance,
Gareth
9 1489 jimatqsi 1,271
Recognized Expert Top Contributor
Gareth,
Records don't "happen." They are created and then maybe later they are modified. In the case of the "happen" being the creation, I mark every record of every data base, whenever possible, with a create date/time stamp. I do that by setting the default value of the creationdate to =Now() - if the table is an Access table. Other data storage tools have different functions for returning the current time.
Doing that then makes it simple to query the database based on creation time. Last modified time is only a little more challenging, but the same concept applies.
Jim
zmbd 5,501
Recognized Expert Moderator Expert
Opps. re-read the question...
You can create a filter that pulls records based on the interval.
Busy with the kids for the moment, however, it shouldn't be too difficult provide you have a date and TIME field(s)
Can you provide us with the structure of your table and any SQL that you've already attempted?
So basically I have a raw table of alarms with fields such as time/date, the description of the alarm etc. I am hoping to be able to filter by a keyword such as electrical failure and then see the subsequent alarms that come in due to the electrical failure.
I haven't attempted any SQL yet as I'm still trying to get my head around how it would even work :)
I am thinking something along the lines of:
=IIf([alarm] Like "*electric*",Between [datetime] And DateAdd("m",5,[datetime]))
Would appreciate any ideas you have.
Thanks
zmbd 5,501
Recognized Expert Moderator Expert
Yes, I understand what you want; however, you haven't provided enough detail as to the actual table structure forms etc...
There are several ways to do what you want and they all depend upon your table structure.
Please check your bytes.com inbox as I'm going to PM you a copy of tutorial, tools, and reference sites that will help you get a handle on things (^_^)
Thanks for the links, they are very helpful.
The structure of the table is very basic. There are no other linked tables, its just a table of raw data with many fields, however the only 2 fields I am concerned about is the time/date and the alarm itself.
I have included an example of the data. If it was to work, I would pick up the word 'electrical' and then only want to filter the next 5 minutes worth of alarms, which in this case would be rows 2 to 5 :)
ID Date/Time Alarm
1 01/01/2014 00:01:00 Electrical Failure
2 01/01/2014 00:02:00 Other Failure 1
3 01/01/2014 00:02:45 Other Failure 2
4 01/01/2014 00:03:00 Other Failure 3
5 01/01/2014 00:04:01 Other Failure 4
6 01/01/2014 00:07:00 Other Failure 5
7 01/01/2014 00:08:00 Other Failure 6
Thanks again for your help.
jimatqsi 1,271
Recognized Expert Top Contributor
Gareth, you can use the DateDiff function to select records based on a difference of time. See http://office.microsoft.com/en-us/ac...001228811.aspx
So once you have the time of the event you can compare that time to another time with - Datediff("n",date/time1,datetime2)
to get the difference in minutes.
And if the later date/time is first you will get a negative number.
Jim
Thanks Jimatqsi, however I'm not sure how I can incorporate the Datediff function in this case? There is only one time which is the start time.
Also, if you filter by the keyword 'electrical', I'm unsure how to show the subsequent 'unrelated' records for the next 5 minutes as the records in the query are filtered.
I'm not entirely sure what I need is even possible...
I believe I got it :)
I filtered the table by the word electrical. Then using that query along with the original raw table in another query (without any relationship) I used the criteria 'Between [datetime] And DateAdd("n",-15,[datetime])' on the date from the filtered query but showed the alarm from the raw table. I also included the date from the raw table. It appears to be working perfect. I will sanity check the data now to make sure its correct.
The above way works perfectly. I ended up using Between [datetime] And DateAdd("s",-900,[datetime]) as seconds were more accurate.
Thanks everyone for their help :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: M Wells |
last post by:
Hi All,
I have a table in SQL Server 2000 that contains several million member
ids. Some of these member ids are duplicated in the table, and each
record is tagged with a 1 or a 2 in to...
|
by: craymel |
last post by:
Hi , can i know how can i make that the page show only TOP 5 record in
the database ?
--
craymel
------------------------------------------------------------------------
Posted via...
|
by: news.online.no |
last post by:
In a query, I need too be able to show if a parent record has a child
record.
Using the query in a combo box too select record in a form.
Thanks
:)
|
by: Prakash |
last post by:
Below is my code to delete a record in a continuous form. I can't
figure out any reason but sometimes (another) record gets deleted
instead of where the record pointer is positioned.
Small table...
|
by: MLH |
last post by:
Before running the following line of code, I would like to first know
if there is another record in the form's record source. If I run this
line when the last record is current, an error is...
| |
by: Joachim |
last post by:
Hi,
Als a beginner, I am looking for a way to show records
My code is
Private sub Connection(
Dim odbconn_Pro As OleDbConnectio
Dim odbcomm_Pro As OleDbComman
Dim odbdare_Pro As...
|
by: Dale |
last post by:
I'm not sure I'm even thinking about this the right way, but here goes:
I have a table of users. Each one of these users may be associated
with none, one, or many records in another table I call...
|
by: jmstur2 |
last post by:
How do I update a field in a record based on the value of another field in another record - in the same table?
Specifically, I want to update the value in the AMOUNT field of record1 with the...
|
by: trixb |
last post by:
Hello all,
Here is what I need to do and need help with:
I have a table that is feeding a chart in a report in Access. If this table has more than 50 records, the graph gets messy, and this is...
|
by: Steve |
last post by:
I have to tables
Table1
IMS_ID
IMS_Name
IMS_Descript
Table2
P_IMS_ID
P_IMS_Name
P_IMS_Descript
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |