473,657 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

displaying records for a certain amount of time that has elapsed

hi there,

I am seeking some guidance in regards to creating a query. I would
like to be able to have the query display records that have had a
certain amount of time pass since the time that is listed a particular
field of the record. There is a field labeld DispTime. This field is
updated with the current time whenever data is typed into another
field on the current record. What I am trying to figure out is how to
create a query that would go through all the records for the day and
list the ones that have had 2 hours pass since the time listed in the
DispTime field. I am using 24hour time. So if it was 10:00 hours and
there were about 5 records whose DispTime field contains 07:00 hours
the query would be able to bring up those 5 records since they are the
only ones who have had two hours pass since the time in their DispTime
field.

That sounds confusing doesn't it? hehe. I apologize ahead of time. =)
Nov 13 '05 #1
3 1810
Chanchito wrote:
hi there,

I am seeking some guidance in regards to creating a query. I would
like to be able to have the query display records that have had a
certain amount of time pass since the time that is listed a particular
field of the record. There is a field labeld DispTime. This field is
updated with the current time whenever data is typed into another
field on the current record. What I am trying to figure out is how to
create a query that would go through all the records for the day and
list the ones that have had 2 hours pass since the time listed in the
DispTime field. I am using 24hour time. So if it was 10:00 hours and
there were about 5 records whose DispTime field contains 07:00 hours
the query would be able to bring up those 5 records since they are the
only ones who have had two hours pass since the time in their DispTime
field.

That sounds confusing doesn't it? hehe. I apologize ahead of time. =)


You want all records that are at least two hours old.

Is that all? hehe. Just nagging Chanchito, please don't take this as an
insult.

Is DispTime a Date/Time field? And do you write Now() in it? In that
case the date is stored with the time, and you can do a simple subtract.
Time is stored as fraction. So two hours would mean a difference of at
least 2/24.

Another way is using datediff("h",di sptime,now())

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
Bas Cost Budde wrote:
You want all records that are at least two hours old.

Is that all? hehe. Just nagging Chanchito, please don't take this as an insult.
np. I realize that it does sound quite rudimentary, but my mind doesn't
seem to be cooperating with me today. =)

Is DispTime a Date/Time field? And do you write Now() in it? In that
case the date is stored with the time, and you can do a simple subtract. Time is stored as fraction. So two hours would mean a difference of at least 2/24.
yes, it is a date/time field, with SHORT TIME format. The field is
updated with NOW() when another field is updated with data. I will see
what I can do with your suggestion of the Subtract using fractions for
time.

Another way is using datediff("h",di sptime,now())

I tried the DateDiff("h", [DispTime], Now()) but it brought back a
strange value. The disptime was 13:07 and when I ran the query at 15:01
it brought back a diff value of 920186. Not sure what that value is in
regards to time and hour.
However, i will keep plugging away at it. Thanks again.
chanch.

Nov 13 '05 #3
my**********@gm ail.com wrote:
np. I realize that it does sound quite rudimentary, but my mind doesn't
seem to be cooperating with me today. =)
I had my private grin when you were done with your description and I
finally understood the question.

Then again, understanding the question is most of the time a large step
towards an answer.
yes, it is a date/time field, with SHORT TIME format. The field is
updated with NOW() when another field is updated with data. I will see
what I can do with your suggestion of the Subtract using fractions for
time.
I have the feeling that DateDiff is just a formatter for this
subtraction. If I query for now()-disptime, I get values like 0,09. You
could use this, multiplying by 24 to get hours into the Integer realm;
if the difference is >2, you have a hit.

That is:

(now() - [disptime])*24 > 2
I tried the DateDiff("h", [DispTime], Now()) but it brought back a
strange value. The disptime was 13:07 and when I ran the query at 15:01
it brought back a diff value of 920186. Not sure what that value is in
regards to time and hour.


Huh? What a strange value. But if your dates are off (mmm... using only
Now?) that may explain it a bit.

I didn't test this on values in a table, with a query, on my first
answer; now that I did, strangely enough, Access (my version at least)
insists in rewriting my "h" into "\h" giving me the impression something
is wrong.

Well, what the heck: two hours is 120 minutes, so try "n" in the
DateDiff. Or stick with arithmetic.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1697
by: Mike | last post by:
I have a view that will return say 5000 records when I do a simple select query on that view like. select * from vw_test_view How can I set up my query to only return a certain # of records, say the first 300?
6
4072
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form the user can change the date, which will force a requery in the subform to bring up records from the date selected. My question is this... The query in the subform is a very simple one, with only three fields being returned. In the interest of...
0
1950
by: Ellen Manning | last post by:
I've got an A2K form with a subform based on a query. This query has a checkbox and an amount field and returns records if checkbox is checked. I Dsum the amount field and display on the main form. If the user unchecks the box, I want the corresponding amount subtracted from the total. If they recheck the box, the amount is to be added. I want all records to appear on the subform even after unchecking them. This works fine...except......
6
4948
by: shreedhan | last post by:
Hi I am trying to write a PHP script such that the users are limited to a certain time to view the page. And I would like to include a countdown timer as well in the page. How can I do that? I am using Apache and PHP5 with mysql in linux operating system. thanks
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
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 we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.