Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging out an Idle User with a warning

Status
Not open for further replies.

RachelBedi

Technical User
Jul 19, 2012
1
US
Hi There,

I need some help, I used the code provided on the Microsoft website to automatically log out idle users which works a treat however I would like to include a warning box which resets the timer if they do not want the program to exit. I did see this link however it does not work in 2003 - there was also an additional response to another person that asked the same question which had her set up a log out status on the back end but that's not really what I want. This code is EXACTLY what I want but I would like to make it work in Access 2003. Can anyone help?


I really want to get this working because I am the only administrator and I can't get in to work on a regular basis as people forget to close down.


Thank you in advance for any help you can provide!
 
My simplest VB version for this is found here: thread222-933476

And, whilst this is not a VBA or Access forum, here's a reworking of that for Access:

Code:
[blue]Option Compare Database
Option Explicit

Private Type LASTINPUTINFO
        cbSize As Long
        dwTime As Long
End Type

Private Declare Function GetLastInputInfo Lib "user32" (li As LASTINPUTINFO) As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private mvarIdleTime As Long

Private Sub Command0_Click()
        DetectIdle 5000, 500
End Sub

Private Sub Form_Timer()
    If GetTickCount - GetInputTick > mvarIdleTime Then
        MsgBox "IDLE for " & CStr(GetTickCount - GetInputTick) & "ms"
    End If
End Sub

Private Sub DetectIdle(ByVal lIdleTime As Long, ByVal lTimerInterval As Long)    
    TimerInterval = lTimerInterval [green]'also activates the Timer if interval<>0[/green]
    mvarIdleTime = lIdleTime
End Sub

[green]' Returns system tick count when last input occurred[/green]
Private Function GetInputTick() As Long
    Static LastInputTick As Long
    
    Dim myLI As LASTINPUTINFO
    myLI.cbSize = Len(myLI)
    GetLastInputInfo myLI
    GetInputTick = myLI.dwTime
End Function[/blue]

 
This is not an Access forum and answering such questions here is inappropriate. Like feeding the neighbors' cats, it encourages continued incursions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top