?
Solved

Settimer - Application.Quit / .ldb deletion issue

Posted on 2006-05-09
2
Medium Priority
?
361 Views
Last Modified: 2012-05-05
Don't think this is an easy one...

I have an mdb application that is frequently left open throughout the night by its operators, numerous training exercises have failed to persuade people to shut the thing down
and so I decided to incorporate a facility to shut down the system (db) automatically in the event of a client (pc) being left idle for a set period of time.

Idle times where attained via: GetLastInputInfo (user32.dll) / timeGetTime (winmm.dll).

The plan was simple, use a form based timer to establish if a given idle time breached the set threshold; in the event that it did a message was displayed in wordpad and the db
was shutdown (DoCmd.Quit).

Marvellous... er, well no...

Seemingly the form timer event interfered with other aspects of the system, menu actions would not work, claiming that they where 'Not available at this time'; I've tried to over
come this problem, but failed.

So it turned to: SetTimer / KillTimer (user32.dll).

I simply pointed the SetTimer to the 'AddressOf' the local function the form based timer executed.

*** basic interpretation of system init code ***

Call SetTimer(Application.hWndAccessApp, 0, 600000,  Addressof app_quit)

***********************************

This did work, the wordpad message was displayed, the system shut down... but a strange thing, the lock file (.ldb) was not deleted; I've tried calling the quit command from
both a VBA function and a Access Macro, but the problem persists.

Since its not being deleted I'm assuming the mdb is not shutting down correctly.

Any thoughts experts (though 500 points hardly seems adequate)?
0
Comment
Question by:DangerM0use
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 16640198
try the M$ way

HOW TO: Detect User Idle Time or Inactivity in Access
http://support.microsoft.com/?kbid=210297
0
 
LVL 1

Author Comment

by:DangerM0use
ID: 16697417
Sorry I've take so long to reply !!

Microsofts suggestion seems a little flakey !

I've come across a number of options very similar to that of MS but non gave the potential flexibility of a
system timer.

The problem with both those and the MS method was referred to in my previous post. Firing the timer event of a form
every second (as in the MS example) causes unexpected issues with the RunCommand VBA feature.

If the two events collide you are presented with rather nasty and unhelpful error.

In the end I managed to get the original solution to work by introducing a couple of delays, seems that Access did not
previously have time to perform a clean shut down; that being said the link you provided was the recommended way
and as such I feel you're due the points.

Thanks for your help.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question