Auto-restart

  • Thread starter Thread starter Rita
  • Start date Start date
R

Rita

How can I make my database shut down and then open again
automatically?

I have a stability problem, and this would be a shortterm
fix.
 
Rita,

AFAIK you cannot do that... it's easy to 'shut down', but once that's
done there's no way to 'open' it again from within itself; it's like
trying to lock a drawer and put the key in. At any rate, this would be a
half measure anyway, so I suggest you try to identify and solve the
problem, rather than circumvent it. If you post back with more details
on your database, the kind of problems you get ('stability' is too
general) and, if at all possible to identify, when this happens, I'm
sure you'll get much more useful advice than just witchcraft to deal
with the wrong problem.

HTH,
Nikos
 
My application runs well on one PC and has nice graphics.
Then on another PC the screen locks up with the message
that there is not enough memory for screen update. This
other PC has inferior graphics (buttons are not shown in
3D-way, and it cant show diabled features in the shaded
fashion - so I believe it is related to a poor graphics
card with too little memory.

It does however seem to be related to time - the longer it
runs the more likely it is to fail - as if the memory use
builds up.... Therefore a auto-restart would be a possible
shortterm fix until the real solution is identified.
 
Do, as Nikos says, resolve the issues.

In the mean time, you can try this:
Create a new database.
Start that database before closing the current one
Get the new database to open the 'current' one


' Spawn a new instance of MS Access and open a file
Shell("C:\Office2003\OFFICE11\MSAccess.exe C:\RestartDatabase.mdb")
Application.Quit ' Shut down the current database

In the startup code for RestartDatabase.mdb place a counter that gives your
application plenty of time to close, and then reopen it

e.g.
For intCount =1 To 2000 ' 2 seconds
Next intCount
Shell("C:\Office2003\OFFICE11\MSAccess.exe C:\MyDb.mdb")
Application.Quit

HTH, Graeme.
 
Rita,

Indeed it looks like a hardware issue, and I'm afraid the only real
solution is an up-to-date PC! In the meantime, something like what
Graeme or Stuart suggested might help... though it looks like yo're
trying to move your household coast to coast in a Yugo!

Nikos
 
One option could be to use the API to pause for 2 seconds. Add the following
two lines of code in the declarations of a module:

'[Used to pause program execution for a specified number of milliseconds]
Public Declare Sub Sleep Lib "KERNEL32.DLL" (ByVal dwMilliseconds As Long)

To use this declaration in your procedures just insert the following line,
but with the 2000 (milliseconds) amended to reflect the length of pause you
require.

Call Sleep(2000)
,

Stuart
 
Back
Top