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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic Log off for idle users 1

Status
Not open for further replies.

SuePee

Technical User
Jun 10, 2003
47
US
Hello!

I posted this problem in the general database section of the website and did not get any responses. Guess no one looks there. So I copied it here. Hope someone can help.

I need to be able to log off idle users on the databases I write. So I looked in the faq section of this site and found exactly what I needed. (FAQ181-1432)

However, when I copied the code into my database it did not work. I receive the following message:

The expression On Timer you entered as the event property setting produced the following error: Syntax Error.
*The expression may not result in the name of a macro, the name of a user defined function or [Event Procedure]
*There may have been an error evaluating the function, event or macro.

I am really handicapped when it comes to this type of thing, so any help would be greatly appreciated.

Thanks a bunch

SuePee


 
Hallo,

Maybe you didn't get any help in the other forum because you didn't give much detail on your actual code and no one could be bothered to ask you for it?

The error indicates that there is a Syntsx Error in the OnTimer event.
It also says that it doesn't understand what you've written in the OnTimer property, or that there is an error in the function, event or macro.

So then, what is written in the OnTimer property?
and does any code referred to in it code compile?

- Frink
 
Thanks for writing back.

I did not post the code because it is quite extensive and is spelled out in faq181-1432.

However, I did figure out where I went wrong in copying the code. There is an If statement that the programmer had broken into several line for clarity. I did not realize that VB wanted this statement in one continuous line. Once I fixed that the code works brilliantly.

I have never taken a course in VB and have only used it in Access applications. All the code I use I get from this site and it is always exceptional.

Again thanks for the feedback.

SuePee
 
The code works for me as well, but I'm having a hard getting the times that I want things to happen.

I want the detect form to come up after 15 min of being idle, and when that form comes up, I only want to give the user 1 minute to do something before the database closes.

Can someone help me with this? Where do I change the time to meet my requirements?
 
This is where you would change the time from 5 minutes to 1 minute
"Const IDLEMINUTES = 5"
See below

-Place this code in the On Timer event procedure...


Private Sub Form_Timer()
' IDLEMINUTES determines how much idle time to wait for before
' running the IdleTimeDetected subroutine.
Const IDLEMINUTES = 5

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
[heart]

Same Circus, Different Clowns
 
Thanks so much for your reply SuePee:)

This will help me tremendously!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top