Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...A lot of the information I've found at this site would've taken me forever if I'd have attempted to research it on my own. Thanks again."

Geography

Where in the world do Tek-Tips members come from?
RachelBedi (TechnicalUser)
19 Jul 12 11:09
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?

http://www.tek-tips.com/faqs.cfm?fid=1432

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!

strongm (MIS)
19 Jul 12 13:38
My simplest VB version for this is found here: thread222-933476: Detect inactivity

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

CODE

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 'also activates the Timer if interval<>0
    mvarIdleTime = lIdleTime
End Sub

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

strongm (MIS)
30 Jul 12 6:15
Was this of any use?
dilettante (MIS)
30 Jul 12 9:04
This is not an Access forum and answering such questions here is inappropriate. Like feeding the neighbors' cats, it encourages continued incursions.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close