473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Log off if a key not pressed for 5 minutes

Is it possible to have Access do a docmd.quit if a key is not pressed for 5
minutes? I have been trying to get users out of a program when it is
necessary to update it. To do this, I have been opening a warning form with
a timer that will log them off with a docmd.quit ater one minute. It seemed
to work for me on a single computer, but on a network, it has not been
successful at all. I am unsure why, but it is possible that the computers
have gone into a locked state after a certain time requiring the user to log
back on with a password - they are using Windows XP Professional. I thought
that if I could have the program monitor for keypresses from a hidden form,
then I could close the application after a certain time without a key press.

If this is possible, how do I get access to run a docmd action after a
certain time with no key presses? Anyone?

dixie
Nov 12 '05 #1
5 3882
See:
http://www.mvps.org/access/general/gen0034.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dixie" <di****@dogmail.com> wrote in message
news:jS***************@nnrp1.ozemail.com.au...
Is it possible to have Access do a docmd.quit if a key is not pressed for 5 minutes? I have been trying to get users out of a program when it is
necessary to update it. To do this, I have been opening a warning form with a timer that will log them off with a docmd.quit ater one minute. It seemed to work for me on a single computer, but on a network, it has not been
successful at all. I am unsure why, but it is possible that the computers
have gone into a locked state after a certain time requiring the user to log back on with a password - they are using Windows XP Professional. I thought that if I could have the program monitor for keypresses from a hidden form, then I could close the application after a certain time without a key press.
If this is possible, how do I get access to run a docmd action after a
certain time with no key presses? Anyone?

Nov 12 '05 #2
Thanks, I checked that one out Allen. I got the file which illustrates it
from Microsoft and found that it works on their form that has the code
behind it, but when I put that code in a hidden from as suggested in the
article, it doesn't give me a message at all. I set it to 1 minute and gave
up after 20 minutes. What I did notice however is that when I run their
sample database, the cursor flashes on and off regularly in its control.
However, when I run my database, the cursor makes a few sluggish attempts to
flash and then just sort of disappears from view. I wondered if that might
be causing the problem and if so, what causes that to happen.

dixie

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
See:
http://www.mvps.org/access/general/gen0034.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dixie" <di****@dogmail.com> wrote in message
news:jS***************@nnrp1.ozemail.com.au...
Is it possible to have Access do a docmd.quit if a key is not pressed for
5
minutes? I have been trying to get users out of a program when it is
necessary to update it. To do this, I have been opening a warning form

with
a timer that will log them off with a docmd.quit ater one minute. It

seemed
to work for me on a single computer, but on a network, it has not been
successful at all. I am unsure why, but it is possible that the

computers have gone into a locked state after a certain time requiring the user to

log
back on with a password - they are using Windows XP Professional. I

thought
that if I could have the program monitor for keypresses from a hidden

form,
then I could close the application after a certain time without a key

press.

If this is possible, how do I get access to run a docmd action after a
certain time with no key presses? Anyone?


Nov 12 '05 #3
If you have error handling in your routines, you may need to disable it
until you get this working?

Without checking the code you are referring to, you may need to undo the
form if it is dirty so that it can be closed?

Could there be other forms open as well, or other pending things you need to
deal with?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dixie" <di****@dogmail.com> wrote in message
news:lx****************@nnrp1.ozemail.com.au...
Thanks, I checked that one out Allen. I got the file which illustrates it
from Microsoft and found that it works on their form that has the code
behind it, but when I put that code in a hidden from as suggested in the
article, it doesn't give me a message at all. I set it to 1 minute and gave up after 20 minutes. What I did notice however is that when I run their
sample database, the cursor flashes on and off regularly in its control.
However, when I run my database, the cursor makes a few sluggish attempts to flash and then just sort of disappears from view. I wondered if that might be causing the problem and if so, what causes that to happen.

dixie

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
See:
http://www.mvps.org/access/general/gen0034.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dixie" <di****@dogmail.com> wrote in message
news:jS***************@nnrp1.ozemail.com.au...
Is it possible to have Access do a docmd.quit if a key is not pressed for
5
minutes? I have been trying to get users out of a program when it is
necessary to update it. To do this, I have been opening a warning
form with
a timer that will log them off with a docmd.quit ater one minute. It

seemed
to work for me on a single computer, but on a network, it has not been
successful at all. I am unsure why, but it is possible that the computers have gone into a locked state after a certain time requiring the user

to log
back on with a password - they are using Windows XP Professional. I

thought
that if I could have the program monitor for keypresses from a hidden

form,
then I could close the application after a certain time without a key

press.

If this is possible, how do I get access to run a docmd action after a
certain time with no key presses? Anyone?



Nov 12 '05 #4
Strangely enough, the code I "borrowed" from the file FRMSMP97.EXE is now
working. I am now loading it as a hidden form when my applciation opens and
it is working "as advertised". Thanks for pointing out the source to me
Allen.

dixie

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
If you have error handling in your routines, you may need to disable it
until you get this working?

Without checking the code you are referring to, you may need to undo the
form if it is dirty so that it can be closed?

Could there be other forms open as well, or other pending things you need to deal with?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dixie" <di****@dogmail.com> wrote in message
news:lx****************@nnrp1.ozemail.com.au...
Thanks, I checked that one out Allen. I got the file which illustrates it
from Microsoft and found that it works on their form that has the code
behind it, but when I put that code in a hidden from as suggested in the
article, it doesn't give me a message at all. I set it to 1 minute and gave
up after 20 minutes. What I did notice however is that when I run their
sample database, the cursor flashes on and off regularly in its control.
However, when I run my database, the cursor makes a few sluggish attempts to
flash and then just sort of disappears from view. I wondered if that might
be causing the problem and if so, what causes that to happen.

dixie

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
See:
http://www.mvps.org/access/general/gen0034.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dixie" <di****@dogmail.com> wrote in message
news:jS***************@nnrp1.ozemail.com.au...
> Is it possible to have Access do a docmd.quit if a key is not pressed for
5
> minutes? I have been trying to get users out of a program when it

is > necessary to update it. To do this, I have been opening a warning

form with
> a timer that will log them off with a docmd.quit ater one minute. It seemed
> to work for me on a single computer, but on a network, it has not been > successful at all. I am unsure why, but it is possible that the

computers
> have gone into a locked state after a certain time requiring the user to
log
> back on with a password - they are using Windows XP Professional. I
thought
> that if I could have the program monitor for keypresses from a

hidden form,
> then I could close the application after a certain time without a key press.
>
> If this is possible, how do I get access to run a docmd action after a > certain time with no key presses? Anyone?



Nov 12 '05 #5
I don't know if you're still following this, but I have now discovered that
the detect idle time form from the Microsft sample database called
FRMSMP97.EXE running in the background, is fiddling with the actuve control
and whenever my code does a DoCmd.GoToControl "ControlName", I now get an
error message saying there is no field called 'ControlName' in the current
record.

The form does as is advertised and detects no activity in the database and
logs people off after a predetermined time, but also interferes with any
code doing with control names on any form in the database.

The code in the DetectIdleTime module is as follows:

Private Sub Form_Timer()
' IDLEMINUTES determines how much idle time to wait for before
' running the IdleTimeDetected subroutine.
Const IDLEMINUTES = 5
' DLookup("[LetterLabel]", "tblButtons", "ControlID=98")

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)
' Dim Msg As String
' Msg = "No user activity detected in the last "
' Msg = Msg & ExpiredMinutes & " minute(s)!"
' MsgBox Msg, 32
Application.Quit acSaveYes
End Sub

Has anyone got any ideas how I can stop this from interfering with my
DoCmd.GoToControl commands?

dixie

"dixie" <di****@dogmail.com> wrote in message
news:gH***************@nnrp1.ozemail.com.au...
Strangely enough, the code I "borrowed" from the file FRMSMP97.EXE is now
working. I am now loading it as a hidden form when my applciation opens and it is working "as advertised". Thanks for pointing out the source to me
Allen.

dixie

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
If you have error handling in your routines, you may need to disable it
until you get this working?

Without checking the code you are referring to, you may need to undo the
form if it is dirty so that it can be closed?

Could there be other forms open as well, or other pending things you need
to
deal with?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dixie" <di****@dogmail.com> wrote in message
news:lx****************@nnrp1.ozemail.com.au...
Thanks, I checked that one out Allen. I got the file which illustrates
it from Microsoft and found that it works on their form that has the code
behind it, but when I put that code in a hidden from as suggested in
the article, it doesn't give me a message at all. I set it to 1 minute and
gave
up after 20 minutes. What I did notice however is that when I run
their sample database, the cursor flashes on and off regularly in its control. However, when I run my database, the cursor makes a few sluggish

attempts
to
flash and then just sort of disappears from view. I wondered if that

might
be causing the problem and if so, what causes that to happen.

dixie

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
> See:
> http://www.mvps.org/access/general/gen0034.htm
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "dixie" <di****@dogmail.com> wrote in message
> news:jS***************@nnrp1.ozemail.com.au...
> > Is it possible to have Access do a docmd.quit if a key is not

pressed for
> 5
> > minutes? I have been trying to get users out of a program when it is > > necessary to update it. To do this, I have been opening a warning

form
> with
> > a timer that will log them off with a docmd.quit ater one minute. It > seemed
> > to work for me on a single computer, but on a network, it has not been > > successful at all. I am unsure why, but it is possible that the
computers
> > have gone into a locked state after a certain time requiring the user
to
> log
> > back on with a password - they are using Windows XP Professional. I > thought
> > that if I could have the program monitor for keypresses from a

hidden > form,
> > then I could close the application after a certain time without a key > press.
> >
> > If this is possible, how do I get access to run a docmd action
after a > > certain time with no key presses? Anyone?
>
>



Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rune | last post by:
Hey I'm trying to build a gui application and need to know if the user is actually holding down the shift or ctrl key. That is, if the user currently is holding down the shift key. In pseudo...
0
by: Koen | last post by:
Hi! What is the best way to check whether a key is pressed without blocking in C++? I know I can use cin.get(c) to get a character from standard input, but this blocks. And I know _kbhit()...
2
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not...
8
by: Syed Ali | last post by:
Hello, I have 1 HTML form with 4 submit buttons and 10 textfield entry areas. If submit button1 is pressed I need to make sure that all 10 textfield entries have been filled before submitting...
3
by: James McGivney | last post by:
I have a project in VS.NET using C# I have a series of buttons on an aspx page. When one of the buttons is pressed, a panel becomes visible and allows the user to enter and edit data. I want to...
4
by: actionwoman63 | last post by:
Dear all I need to be able to check which one out of two submit buttons within the same form was pressed in a javascript function prior to form submission. And before I get flamed for not...
3
by: prakashsha | last post by:
HI, I've an asp.net page which has a button. On click of the button the program queries the database and gets the result and displays the same.Now assume that my program takes 2 minutes to get the...
19
by: darrel | last post by:
On my vb.net page, I have 4 sets of inputs + form buttons. example: Search: (GO) Zip: (GO) County: (GO) County: (GO) The problem is if I go to the page, type in a zip code, and hit...
6
by: Stefan Mueller | last post by:
With the following code I can figure out if 'Enter' has been pressed: ... onKeyPress = "if (check_enter(event)) {alert('Enter has been pressed');}" function check_enter(eventobjekt) { var...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.