if the form that has the table recs in it.
set the timer on the form for say 30 secs: 30000
Everytime a mouse is moved or something clicks, reset the timer
then the timer hits the limit , run the delete query.
but set any mouse click or data update to reset: mlTicks = 0
Code:
private miTimerMins as integer
private mlTicks as long 'elapsed non activity ticks
private mlTickLimit as long
Code:
sub Form_Load()
'30 mins
miTimerMin = 30 'or set in a tConfig tbl as default =Dlookup("[TimerMins]","tConfig")
me.timerInterval = 30000 'default form timer = 30 secs. (aka 30000)
'the limit of inactivity
mlTickLimit = (miTimerMin * 60 * 1000) 'minutes * sec/hr * millisecs (aka ticks)
end sub
Code:
Private Sub Form_Timer()
Code:
mlTicks = mlTicks +me.timerInterval
if mlTicks >= mlTickLimit then
docmd.openquery "qdDeleteTmpTbl"
me.requery
endif
end sub
reset the ticks if mouse clicks . or other events.
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mlTicks = 0
End Sub