Open your form in design view.
Properties
Form
Events
[On Timer] event
This is where you will place your code
This will trigger every time the timer counts down from the time the form opens; thus you need a flag - tempvars collection comes to mind. I have in the past use the form Tag property that I set to 0 on load and 1 in the other events. In the timer event itself I reset the tag to zero once the action has taken place.
- Private Sub Form_Timer()
-
If Me.Tag Then
-
MsgBox "timer event tag is" & Me.Tag
-
Me.Tag = 0
-
End If
-
End Sub
-
[Timer Interval] == 30seconds ==> 30000
thus 5seconds would be 5000
Now in the [On Change] events you need to have for say a 10 second delay:
- Me.TimerInterval = 10000
-
me.tag = 1
Now every time the event fires, it resets the interval and sets the flag. If the interval expires before the next event resets then [on timer] event fires, runs its course, and clears the flag.
Move all of your other query code into either the [On Timer] event or as a private procedure(s) within the form or as a standard module and then call the procedure from the event, either way.
Hope that's clear - I've only glanced at jforbes code so you'll have to play with things a bit to get the timing and key/mouse-trapping just right.
This is along the same idea as the idle out timer found here:
home > topics > microsoft access / vba > insights > inactivity detection in access