Solved

Time interval to automatically close an Access application

Posted on 2004-10-21
1,299 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
Question by:ssmith94015
    2 Comments
     
    LVL 2

    Accepted Solution

    by:
    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
    I will try, this is more than I hoped for.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Suggested Solutions

    Title # Comments Views Activity
    countTriple  challenge 8 49
    Tool to format notepad++ 1 54
    has22 challenge 11 46
    map interface methods 3 35
    I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    934 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now