Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    2

    Unhappy Unanswered: getting number of commited transactions

    Hello,

    I developed an Access 97 application which is used by up to 5 users at the same time. As the users tend to open the application, review some datasets and then leave it open I'd like to shut down the application for a user in case he has no further commited transactions for some time.

    I found that the tool ldbview.exe shows the amount of transactions, but this feature is neither documentated in the in the accompanying White Paper or the documentation of msldbusr.dll.

    So I'd like to ask if somebody knows how to use this feature or perhaps has found another way to solve this problem.

    Karsten

  2. #2
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    Havn't used the feature myself, but do use the following routine. You may be able to adapt it to your circumstances.

    'Create a blank form that is not based on any table or query and name it DetectIdleTime.

    'Set the following form properties:
    'OnTimer: [Event Procedure]
    'TimerInterval: 1000
    'NOTE: The TimerInterval setting indicates how often (in milliseconds) the application checks for user inactivity. A setting of 1000 equals 1 second.

    'Enter the following code for the OnTimer property event procedure:
    Sub Form_Timer()
    ' IDLEMINUTES determines how much idle time to wait for before
    ' running the IdleTimeDetected subroutine.
    Const IDLEMINUTES = 1
    Static prevcontrolname As String
    Static prevformname As String
    Static expiredtime
    Dim activeformname As String
    Dim activecontrolname As String
    Dim expiredminutes
    On Error Resume Next
    ' Get the active form and control name.
    activeformname = Screen.ActiveForm.Name
    If Err Then
    activeformname = "No Active Form"
    Err = 0
    End If
    activecontrolname = Screen.ActiveControl.Name
    If Err Then
    activecontrolname = "No Active Control"
    Err = 0
    End If
    ' Record the current active names and reset ExpiredTime if:
    ' 1. They have not been recorded yet (code is running
    ' for the first time).
    ' 2. The previous names are different than the current ones
    ' (the user has done something different during the timer
    ' interval).
    If (prevcontrolname = "") Or (prevformname = "") _
    Or (activeformname <> prevformname) _
    Or (activecontrolname <> prevcontrolname) Then
    prevcontrolname = activecontrolname
    prevformname = activeformname
    expiredtime = 0
    Else
    ' ...otherwise the user was idle during the time interval, so
    ' increment the total expired time.
    expiredtime = expiredtime + Me.TimerInterval
    End If
    ' Does the total expired time exceed the IDLEMINUTES?
    expiredminutes = (expiredtime / 1000) / 60
    If expiredminutes >= IDLEMINUTES Then
    ' ...if so, then reset the expired time to zero...
    expiredtime = 0
    ' ...and call the IdleTimeDetected subroutine.
    IdleTimeDetected expiredminutes
    End If
    End Sub

    Sub IdleTimeDetected(expiredminutes)
    'Message shown when idle time detected.
    '
    Dim Msg As String
    Msg = "No user activity detected in the last "
    Msg = Msg & expiredminutes & " minute(s)!"
    MsgBox Msg, 48
    '
    'Close and quit application
    '

    Application.Quit acSaveYes

    End Sub

    David

  3. #3
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    2

    thanks

    Thanks a lot, I guess this will help!

    Karsten

Posting Permissions

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