Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Location
    Can Jose, CA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Close a form after no activity for some period of (Access2k)

    Is there a way to time "no activity" on a specific form and then close it based on a set time period.
    The on timer / set interval function works for timing how long a form is open but closes the form while data entry is in progress when timer goes off. Is there some kind of "quite or silent" function in access?

  2. #2
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close a form after no activity for some period of (Access2k)

    Hi chriss

    Check out LogUsersOffNonUse.mdb at www.RogersAccessLibrary.com

    HTH

    John

  3. #3
    Star Lounger
    Join Date
    Aug 2001
    Location
    Can Jose, CA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close a form after no activity for some period of (Access2k)

    Thanks for the reply John.
    I have added the code to my database but at time out, the program errors and the debug highlights code in the FORM_TIMER(): Set snp = db.OpenRecordset("tblLastUsed", dbOpenSnapshot)
    I have added the table tblLastUsed and when checked, it has updated to the time the form opened.
    Is there a difference in the command line from Access 97 to 2K or other possibilities?

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close a form after no activity for some period of (Access2k)

    Hi Chriss

    Following is my timer code:

    I combined both LogUsersOff.mdb and LogUsersOffNonUse.mdb in my appl.

    I'm new to access myself and I remember spending alot of time understanding the demo's before applying them to my db

    I converted them to a2k when initially opened and they worked OK.

    I have a split db and tblLastUsed should be in the front end

    For LogUsersOff.mdb, tblCustCounter is a one record table in the back end that hold the intLogoff switch

    My minutes to unlog are coming from user preference file.

    You also need DAO ref's

    HTH

    John

    '02/24/01 Log Users Off Now, from Rogaer, requires this hidden form with On Timer set
    ' to this Sub, Timer Interval = 60000 frm_Exit_Now and tblCustCounter table
    ' with LogOff yes/no, Private Sub Form_Load & Private Sub Form_Timer

    Private Sub Form_Timer()

    Dim db As DAO.Database
    Dim snp As DAO.Recordset
    Dim msg As String, intLogoff As Integer
    Dim dtLastUsed As Date ' 02/24/02 Log Users Off After Non Use from Roger

    Set db = CurrentDb
    Set snp = db.OpenRecordset("tblCustCounter", dbOpenSnapshot)
    intLogoff = snp![LogOff]
    snp.Close
    db.Close

    If intLogoff = True Then
    If Me.tag = "LogOffNowMsgSent" Then
    Application.Quit (acQuitSaveAll)
    Else
    Me.tag = "LogOffNowMsgSent"
    DoCmd.OpenForm "frm_Exit_Now", , , , , , "Log Off Now"
    Exit Sub
    End If
    End If
    Set db = Nothing
    Set snp = Nothing

    ' 02/24/01 Log Users Off After Non Use from Roger
    Set db = CurrentDb
    Set snp = db.OpenRecordset("tblLastUsed", dbOpenSnapshot)
    dtLastUsed = snp![LastUsed]
    snp.Close

    'change the value in the next line to the number of minutes
    'you want to test for
    Dim lngMinutes As Long
    lngMinutes = GetPref("Minutes to Log Off Inactive User")
    If DateDiff("n", dtLastUsed, Now) > lngMinutes Then
    'If DateDiff("n", dtLastUsed, Now) > 360 Then
    If Me.tag = "InactiveUserMsgSent" Then
    Application.Quit (acQuitSaveAll)
    Else
    Me.tag = "InactiveUserMsgSent"
    DoCmd.OpenForm "frm_Exit_Now", , , , , , "Inactive User"
    End If
    Else
    Me.tag = ""
    End If
    Set db = Nothing
    Set snp = Nothing

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •