Is it possible to Auto Close an Access db at a scheduled time?

A

AFSSkier

Is it possible to Auto Close an Access db a scheduled time?

I have a multi-user db with a BackEnd & 60+ FrontEnds. I have a windows
scheduled db that freshes the BE tables (nightly, wkly, mnthly). Everyone
knows they should close their FE dbs everynight. I have them do this because
I had someone locked a table & one of my append macros crashed.

I would like to put an Auto Close feature on all of the FE dbs, to close the
open ones at a scheduled time. Sometimes just the SwitchBoard on some of the
client PCs will lock me out (Record-Locking BE).

Or How can I set up the BE security for read only for all the users & write
(updatable) for my client only?
 
P

(PeteCresswell)

Per AFSSkier:
I would like to put an Auto Close feature on all of the FE dbs, to close the
open ones at a scheduled time. Sometimes just the SwitchBoard on some of the
client PCs will lock me out (Record-Locking BE).

Timer() event in a form that's always open (an not necessarily
visible).

Set the Timer() to fire at some minimal frequency (i.e. interval
is max allowed) and have it check time of day each time and Quit
the app when the time comes.

I've done this in a few applications except that the loop looks
for the presence of a text file and kills the app if the text
file is present.
 
A

Albert D. Kallal

yes, there is sample download, and I have successfully used it in several
applications.

a97
http://support.microsoft.com/default.aspx?scid=kb;en-us;128814

a2000
http://support.microsoft.com/default.aspx?scid=kb;en-us;210297

As long as a user not "stuck" in a dialog box, it will work fine.

If you printing from a custom menu while viewing a report, then you have to
add a select object command.

This is needed to fix a "focus" bug if you have a form with a timer
function.

so:

On Error Resume Next
DoCmd.SelectObject acReport, Screen.ActiveReport.Name <--- add this
if you have a timer
DoCmd.RunCommand acCmdPrint
 
A

AFSSkier

Pete,

What is the interval max time allowed, will 8 hrs work (28800000ms)?
How can I have it check the time of day & quit? Please share code.

Also is it possible to have the app minimize, so an active user doesn't
force a windows close while it's compacting on close. "Out side out of mind"
 
A

AFSSkier

Albert,

What really concerns me about your suggestion is MS warning "Note Using this
code to add records to a table when a database is idle may result in
excessive memory consumption".
 
A

Albert D. Kallal

AFSSkier said:
Albert,

What really concerns me about your suggestion is MS warning "Note Using
this
code to add records to a table when a database is idle may result in
excessive memory consumption".

Interesting. I assume the above means don't place code in that timer stuff
that adds records to the database. I don't think you are intending to do
this, so it should not be a problem. The above is not suggesting that a user
or even code adding records is a problem, but using the CODE SAMPLE to add
records is the problem.

I been running a few applications for about 8-9 years using that code
sample..and I not had a problem with stability....
 
P

(PeteCresswell)

Per AFSSkier:
What is the interval max time allowed, will 8 hrs work (28800000ms)?
How can I have it check the time of day & quit? Please share code.

I think it's 65,535 as in Forms!frmHome.TimerInterval = 65535


Once I do that, frmHome's Timer() event starts firing every
minute or so.

In my case, what it does is to check to see if a certain .txt
file is present.

Once that files appears, I open up screen that tells the user we
are going to shut down the app in N seconds and if they want to
keep it alive, they have to click a certain button - which puts
the shutdown off by N minutes. That protects the person who is
working at the time my process wants the application. My
process loses, but the person working gets to keep working.

frmHome's Timer() routine:
---------------------------------------
Private Sub Form_Timer() ' NO ERROR TRAPPING
On Error Resume Next

' PURPOSE: If a certain text file is found, open a form that
eventually closes the application.
'
' NOTES: 1) This became necessary because the application is
left open to print daily reports each
evening. The reports don't finish printing until
everybody has gone home - leaving
' the app open and creating problems for the backup
utility.
' 2) You may notice that this forms .TimerInterval is
zero and wonder how this routine ever starts.
Answer is that basOther/appKillCheck_Begin() sets
the form's .TimerInterval.
' appKillCheck_Begin() is called from the daily and
monthly report print routines.
' 3) There is no error trapping because the asynchronous
operation of Timer events confuses
' the debug stack.

If FileExist(AppKillFilePath_Get()) Then
On Error Resume Next
DoCmd.OpenForm "frmAppKill"
End If

Exit Sub
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top