Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interrupt timer event 1

Status
Not open for further replies.

jpl458

Technical User
Sep 30, 2009
337
0
0
US
Is it possible to interrupt the timer event. I have an app that runs every 30 seconds, it reads a database, updattes a table in the app, then moves data to textboxes on a form thats being displayed. The ap counts item than have been removed from a bay. The users need to be able to add to the total items in a bay or to all the bays. I have that code and it works. But if I hit the Add Balls button the ap keeps doing the loop over and over. When writing the code I strategically placed a msgbox so I could interrupt the process manually. If I hit Break there is a long lag before the code breaks. That is not the solution.

The ap has an OnOpen event, an OnTimer event, and dblclick event on a couple of buttons. I want the button to interrupt the ongoing timer event, it that is possible.

Thanks, any help or suggestiions would be appreciated.

jpl
 
Which Application ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry for the lack of info:

ACCESS 2010

jpl
 
To disable the Timer event set the TimerInterval property to 0

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Forum705
Forum702

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Add [tt]DoEvents[/tt] to your Timer event.

Have fun.

---- Andy
 
Wasn't detailed enough in first question. Sorry for that.
Ap has the following parts (Without all the code included.

Data is kept in a table in the ap that is used for running calculations.
Primary ata is from SQL Server Datasbase
OnOpen event
Relinks the tables and does some housekeeping
AllFilled Button
dblclick Updates the ACCESS table with max amount for each station.
StationFilled Button
dblclick User can add a specific amount to an individual station in the ACCESS table.

OnTimer event that runs every 30 secons (30000 ms)
Setup Select query of the SQL Database
Run the query and
Do while Recordset not EOF =true
Update the ACCESS table
Update the form on the screen
Loop til recordset eof
Do some Housekeeping
End sub
The user will need to break in to the timer event by hitting the "Fill" buttons.
So the question is, is there a way to cleanly do that. Now the wait is long, maybe through sever iterations of the timer event. And some time it never comes up - the time event keeps running.

Sorry for getting back so late, but the were other issues.

Thanks for the help

jpl






 
I'd create a global boolean variable set to True at the beginning of the Fill event and to False at the end.
Then in the Timer event:
if boolean is true then Exit Sub
Setup Select query of the SQL Database
DoEvents
if boolean is true then Exit Sub
Run the query and
Do while Recordset not EOF =true
Update the ACCESS table
Update the form on the screen
DoEvents
Loop til recordset eof or boolean is true
Do some Housekeeping

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'll have to play with this, but I get the idea. Skip, long is sometimes 5 minutes or so, but hey need to break in quick.

May be back at the well on this one.

Thanks for the quick responses

jpl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top