Prevent database being opened again

N

Neil

Hello Everyone,

I'm stumped! I have been searching through the google newsgroups to try and
find a solution to my problem. At the moment when my database loads, I use
some code to hide the Access window and just display my Form. The problem
that I have now is that I dont know how I can check to see if the database
is already running as it is not displayed in the taskbar. In fact, the only
way you can tell if it is running is when you do ctl+alt+del and it is then
displayed in Windows Task Manager (Windows XP). I was going use some code
that would loop through the taskbar and check the names of all programs
open - if the database name was in there then the function returns true.
Anyone got any ideas? Some other useful information is that I have a custom
visual basic program running (which checks the database @ certain times) and
this is where I am trying to detect if Access is running.

TIA,

Neil.
 
N

Neil

I have solved this problem. I tracked the Hwnd property of the form and then
from my other application used an API function call SetForeGroundWindow. It
returns true if window found so it does the job.

Thanks,

Neil.
 
A

Andy Cole

Neil

Have a look at the following. It prevents multiple instances of a DB being
run;

http://www.mvps.org/access/api/api0041.htm

This will prevent you opening another instance of the same DB on a
particular machine. Provided that you are *not* sharing the DB (or
Front-end if its a typical split DB) it should do the job.

HTH

Andy
 
N

Neil

Thanks Andy,

I'll look into that,

Neil.
Andy Cole said:
Neil

Have a look at the following. It prevents multiple instances of a DB being
run;

http://www.mvps.org/access/api/api0041.htm

This will prevent you opening another instance of the same DB on a
particular machine. Provided that you are *not* sharing the DB (or
Front-end if its a typical split DB) it should do the job.

HTH

Andy
 

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