Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Time interval to automatically close an Access application

Posted on 2004-10-21
2
Medium Priority
?
1,318 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:ssmith94015
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
skeeveswp earned 500 total points
ID: 12387498
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
 

Author Comment

by:ssmith94015
ID: 12464553
I will try, this is more than I hoped for.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Screencast - Getting to Know the Pipeline

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question