473,386 Members | 1,693 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,386 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 1792
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.