473,396 Members | 1,998 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,396 software developers and data experts.

How to Close a Form if not in Use


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
3 7580
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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: marcelf3 | last post by:
Hello.. This page opens a window with some information, but everytime the user changes a field in the parent window, the child window needs to be closed. These 2 functions were supposed to do the...
1
by: Jules Winfield | last post by:
My WinForms application can have any number of top level forms open at a given time. If the user selects File|Exit, all of the forms are closed. The loop to close the forms looks something like this:...
2
by: Chien Lau | last post by:
Hi, At a certain point in my application, I have access to a Form object. I want to close that form: form.Close(); There are any number of reasons why this form might not close. A common...
7
by: Alice | last post by:
Hi, In my program, the user can navigate to many different forms. When they go to the next form, I want the form they have left to close. However, the forms aren't closing. Can anyone tell me...
5
by: Stan Sainte-Rose | last post by:
Hi, Which event is called when the user click on the close window icon (X) ? I want, when he clicks on this icon, to display a message before closing the form. If he replys by No, I don't want to...
6
by: Tom | last post by:
Is there ANY easy way to close a MDI Child form in the middle of it's load? For instance, during the Load event I find a need to close the form (for whatever reason - maybe the user isn't ready for...
5
by: AP | last post by:
IS there a way to run a procedure if the users close access directly rather than closing a menu screen that I have built? There is an event that works on close for this form, but it doesnt seem to...
6
by: scott | last post by:
I guess this is a simple one but I can't seem to get it to work. I want to refresh an open form "onClose" of another. I have a Close button on a form which has User Details on it. If I update...
3
by: rdemyan via AccessMonster.com | last post by:
I need help with code to close two forms at the same time, FormA and FormB. I need code that can be used from either form and needs to work with both a 'Close' button on each form as well as if the...
1
by: dan.c.roth | last post by:
oForm.Close() vs this.Close() in a modal dialog. oFrom.Close() calls Form.Dispose() but this.Close() ,say in the click event of the Form, does not. I can think of the reason for this but is...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.