By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,411 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

How to Close a Form if not in Use

P: n/a

I use a Access database with front ends on each PC and the back end with
the data on a main server. A number of the PC's keep leaving forms
open displaying data. This causes problems if another user wants to
access the record they have open. Is there a way to put some sort of
timer on the form so if it is left idle for a period of time then it
would automaticly close down.
--
Posted via http://dbforums.com
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 04 Sep 2003 17:51:50 -0400 in comp.databases.ms-access,
AlanFern <al**@amfern.co.uk> wrote:

I use a Access database with front ends on each PC and the back end with
the data on a main server. A number of the PC's keep leaving forms
open displaying data. This causes problems if another user wants to
access the record they have open. Is there a way to put some sort of
timer on the form so if it is left idle for a period of time then it
would automaticly close down.


Set form's KeyPreview = yes.

(declarations section)
Private mlngTimeout as Long

(Assuming Timer interval set to 1000)
Sub Form_Timer()
mlngTimeout=mlngTimeout + 1
if mlngTimeout > 60*5 Then ' 5 minutes
Me.Undo
Docmd.Close acForm, Me.Name
End Sub
End Sub

Sub Form_MouseMove()
mlngTimeout = 0
End Sub

Sub Form_KeyUp()
mlngTimeout = 0
End Sub
--
A)bort, R)etry, I)nfluence with large hammer.

(replace sithlord with trevor for email)
Nov 12 '05 #2

P: n/a
Why not just use the NO-Locks as a record locking strategy on your back-end?
Tools-->Options-->Advanced Tab

"AlanFern" <al**@amfern.co.uk> wrote in message
news:33****************@dbforums.com...

I use a Access database with front ends on each PC and the back end with
the data on a main server. A number of the PC's keep leaving forms
open displaying data. This causes problems if another user wants to
access the record they have open. Is there a way to put some sort of
timer on the form so if it is left idle for a period of time then it
would automaticly close down.
--
Posted via http://dbforums.com

---
This email from Barry Wright has been scanned using AVG 6.0 and is certified
Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.514 / Virus Database: 312 - Release Date: 08/28/2003
Nov 12 '05 #3

P: n/a

Originally posted by Trevor Best
On Thu, 04 Sep 2003 17:51:50 -0400 in comp.databases.ms-access, AlanFern <al**@amfern.co.uk> wrote:
I use a Access database with front ends on each PC and the back

end with

the data on a main server. A number of the PC's keep leaving

forms

open displaying data. This causes problems if another user wants

to

access the record they have open. Is there a way to put some

sort of

timer on the form so if it is left idle for a period of time then

it

would automaticly close down.

Set form's KeyPreview = yes. (declarations section) Private mlngTimeout as Long (Assuming Timer interval set to 1000) Sub Form_Timer() mlngTimeout=mlngTimeout + 1 if mlngTimeout > 60*5 Then ' 5 minutes Me.Undo Docmd.Close acForm, Me.Name End Sub End Sub Sub Form_MouseMove() mlngTimeout = 0 End Sub Sub Form_KeyUp() mlngTimeout = 0 End Sub -- A)bort, R)etry, I)nfluence with large hammer. (replace sithlord with trevor for email)


Hi Thanks very much for the reply, I will give it a try.

Regards, Alan
--
Posted via http://dbforums.com
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.