Web Images News Groups Books Scholar Google Mail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Stop access database being opened a second time
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mike Labosh  
View profile  
 More options Dec 10 2004, 5:54 pm
Newsgroups: microsoft.public.access
From: "Mike Labosh" <mlab...@hotmail.com>
Date: Fri, 10 Dec 2004 12:54:22 -0500
Local: Fri, Dec 10 2004 5:54 pm
Subject: Re: Stop access database being opened a second time

>    If a user already has my frontend opened on their pc, I want a message
> to appear when they open it a second time. How can I check for this?

A Mutex Question!  These are always fun!

"Mutex" stands for "Mutually Exclusive".  In the WIN32 API SDK, a Mutex is a
system-level resource that can only be held by one process.  To accomplish
what you want, you can have your startup code create a mutex with a specific
hard-coded name, and hold the Mutex's handle in a public global variable.
Then your shutdown code passes that handle back to windows to release it.
Then, when a user starts a second instance of your application, the new call
to CreateMutex() fails, and you can MsgBox the user and quit.  The only
catch is that if you're in the VBA debugger and "reset" your code, you lose
the mutex handle and will be unable to release it.  Lookup these two
functions in MSDN:

CreateMutex()
ReleaseMutex()
--
Peace & happy computing,

Mike Labosh, MCSD
"I have no choice but to believe in free will."


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google