Requerying

ddrew

seasoned user
Local time
Today, 21:44
Joined
Jan 26, 2003
Messages
911
Im not sure if im going about my problem in the right way! I have a continuous form with a time capture box (Text 1)on it. A button is pressed and the time is captured, a second box equals this time + 10 minutes (Text 2). I also have a clock when the clock reaches as the same time as that in (Text 2) a message appears informing the user that 10 minutes have passed. My problem that it will only do this on the record with the focus. I want it to look at every record in the list. Is this possible?
 
No... that is not possible... the on timer event that is triggered on the form only works on the form.

You can, if the times are stored in the table.. use a query you trigger in the "on timer" event to query if any records have passed the 10 minutes. Allthough, you probably will not want to check that every second or even every 10 seconds as it will, once your DB contains more and more data... it will slow down your form considerably.

Alternative could be that you store the (next) time a 10 minute window passes in memory of the form. Then in your on timer event you check if that time has come without having to run the query.
Then only once the time has come you have to query to find the next time.... etc.

Hope that helps.
 
You can, if the times are stored in the table.. use a query you trigger in the "on timer" event to query if any records have passed the 10 minutes. Allthough, you probably will not want to check that every second or even every 10 seconds as it will, once your DB contains more and more data... it will slow down your form considerably.

The Start Time is stored the Start Time + 10 mins isnt currently but it could be quite easily. Checking every second isnt a problem as the database is emptied daily into a master so there would only be about 30 records at a time anyway. Any chance you could show me what the query may/could llok like. Thanks
 
StartTime + 10 mins SHOULD NOT be stored, as it is a calculated value! Recalculating it from the StartTime is easy enough. You should only store either the StartTime or the StopTime depending on what you expect you will need most.

The query would be simple... much like you can make in the query designer
Select *
from yourTable
where DateAdd("M",10, [StartTime]) <= Now()

This will return all records beyond 10 minutes, offcourse this would be in code... so then you need some logic/code to show it to the user.... but that is something you can figure out on your own I think?
 
My problem that it will only do this on the record with the focus. I want it to look at every record in the list.

This statement, plus the fact that he's been able to add a command button, makes me think that the form in question is a continuous form. If this is true, the textbox Text2 will, indeed have to be bound to a field in the underlying table. If it not, when the button in the first record is clicked, every record's Text2 will be set to the same time. As in most rules, the one against storing a calculated value does have valid exceptions.
 

Users who are viewing this thread

Back
Top Bottom