Time interval to automatically close an Access application

I need to set up a time-out function in my access database.  Bascially, I want the application to close automatically if the user has not done anything with the form for 20 minutes.   I know there is a time interval on the form, but I cannot find anything that tells me how to use or program this.
Thanks
Sandra SmithRetiredAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

skeeveswpCommented:
The timer works by firing an event each time the timer interval is reached.  The timer interval is set in ms, so your 20 minutes is going to be ... 1200000 ms.  After the timer runs 20 seconds, the timer event fires, and you can close your application.

The trick is going to be resetting the timer each time a process runs.  The most effective way to do this is to set the timerinterval for the form object to 0 at the start of each process and then setting it back to 1200000 at the end of the process.  Setting the interval to 0 essentially resets the timer and disables it.  Setting it to a value will start it up again.

You can check this out with this code sample ...

Private Sub Command0_Click()
    Form_Form1.TimerInterval = 0
End Sub

Private Sub Command1_Click()
    Form_Form1.TimerInterval = 4000
    Text2 = CStr(Now())
End Sub

Private Sub Form_Timer()
    Text2 = CStr(Now())
End Sub

Note that I used three controls, two command buttons and a text box.  You can modify this to test a single command button by doing something like this:

Private Sub Command0_Click()
    if form_form1.Timerinterval = 0 Then
        form_form1.TimerInterval = 4000         ' 4 Seconds
        text2 = cstr(now())
    else
        Form_Form1.TimerInterval = 0
    end if
End Sub

Each time you click the command button the timer interval will be toggled, and if you are enabling the timer the start time and updating intervals will be displayed in the text box.

Hope that helps.

-- Seve
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sandra SmithRetiredAuthor Commented:
I will try, this is more than I hoped for.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.