Access Shell statement

S

Secret Squirrel

I have an Access97 database that runs some automated routines on my PC every day, including opening
a DUN connection automatically. I'll refer to this database as DB#1.

Sometimes a second Access97 database runs in the background. I'll refer to this as DB#2.

Both DB#1 and DB#2 will issue a Shell command to shut down Windows98 by force, after they have
finished their respective processing.
The VBA command I use to shut down Windows98 is:
varResult = Shell("C:\WINDOWS\rundll32.exe shell32.dll,SHExitWindowsEx 1")
which is a shutdown by "FORCE" (i.e. ignore any other running applications and shutdown regardless).

Whichever database finishes first will issue the shutdown Shell call.
I use this technique to ensure that any open DUN connection is terminated come what may.

Both these two databases work fine if only one of them is running and issues the shutdown Shell.

However, when the both databases are running and either one of them issues the Shell, I receive a
pop-up error message - "You can't exit Microsoft Access now." and the PC freezes. No error number
is shown.

It seems that the pop-up error message occurs because Access doesn't like the fact that one database
is trying to force the closure of Windows (and hence Access itself) when another Access database is
still running elsewhere? This conflicts with what I understood of the VBA Shell command as being
asynchronous and therefore [I believed] not tied to the database processing.

These problems only happen when BOTH databases are running at the same time. Why?
Or is there another reason?
 

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