473,229 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,229 software developers and data experts.

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 1785
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",disptime,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",disptime,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**********@gmail.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
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...
6
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...
0
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...
6
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...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.