form timeout
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access Training and help » Form Time-Out

Form Time-Out

resolvedResolved · Low Priority · Version Standard

replyReply Wed 13 Feb 2008, 16:03Delegate Clyde said...

Clyde has attended:
Access Introduction course
Access Intermediate course
Access Advanced course

Form Time-Out

How would I go about getting a form to auto-close after a set amount of time in a state of inactivity?

For upcoming training course dates see: Pricing & availability

replyReply Fri 29 Feb 2008, 13:37 Edited on Fri 29 Feb 2008, 13:38Trainer Carlos said...

Form Time-Out In Access

Hi Clyde

To get you form to time-out after a certain amount of time do the following:

1. Create a macro that closes the required form

2. In the Forms Properties area select the Events tab

3. In the On Timer event select the macro created to close the form.

4. In the Time Interval section enter the time interval to close. (eg 30000)

NB For the Timer Interval 1,000 = 1 Second, 60,000 = 1 minute and 3,600,000 = 1 Hour

The timer starts when the form is opened.

Now the above Timer Interval value starts the timer as soon as the form opens and closes the form after the set time, whether it is inactive or not.

To overcome this as there is no Inactive event we need to keep reseting the clock on some Mouse and Keyboard actions.

To do this:

1. In the Key Press event select Event Procedure

2. Click the 3 dots to open the code window

3. Copy the following code and paste it in the code window:


Private Sub Form_KeyPress(KeyAscii As Integer)

Me.TimerInterval = 30000

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Me.TimerInterval = 30000

End Sub

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)

Me.TimerInterval = 30000

End Sub



NB The code resets the Time Interval back to our example value of 30000, everytime a key is clicked, or the mouse wheel or the mouse is moved on the form.

If these events cease to occur after the predetermined time the system will close the form

Hope this helps

Carlos

replyReply Fri 29 Feb 2008, 16:17Delegate Clyde said...

RE: Form Time-Out In Access

Hi Carlos,

This works perfectly! Thank you very much!

Clyde

 

Please browse our web site to find out more about
ms access course and other Microsoft training courses.

Access tip:

Hide Access Tables

One method of stopping your Access tables appearing in Database window, is to rename the table(s) with the prefix usys.

This converts the table into a system object, which cannot be viewed in the Database window.

You can show system objects in the Database window by the following:

Step 1: On the Tools menu, click Options.
Step 2: Click the View tab.
Under Show, select the System Objects check box.
Click OK.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard