PC Review


Reply
Thread Tools Rate Thread

Determine if current database is open exclusively.

 
 
=?Utf-8?B?U3R1YXJ0TQ==?=
Guest
Posts: n/a
 
      20th May 2005
Hi,

Is there any a nice and clean way via VBA to determine if the current user
has opened the database exclusively?

I have had a problem with the Jet User Roster schema not working when I have
passed the /Excl command line switch (error 3251 - Object or Provider is not
capable of performing requested operation). I can catch this command line
switch without a problem, but I want to cover the possibility that a user has
opened the database exclusively from the File > Open menu option.

Cheers,

Stuart
 
Reply With Quote
 
 
 
 
=?Utf-8?B?JzY5IENhbWFybw==?=
Guest
Posts: n/a
 
      22nd May 2005
Hi, Stuart.

> Is there any a nice and clean way via VBA to determine if the current user
> has opened the database exclusively?


I'd put in error handling to catch the 3251 error whenever it happens, but
if you'd like another function to do the checking, then create a function
that uses the OpenDatabase( ) method to open the database in shared mode.
Create an error handler for this function that handles error numbers 3051 and
7866. If either of these error numbers are encountered while opening the
database programmatically, then the database is either open exclusively or
the specific file doesn't exist.

If by "current user" you mean the user who has opened the database needs to
check the current database, then the OpenDatabase method should be used
within a separately created Workspace object, not the default Workspace
object. If, on the other hand, the "current user" is any user who has a
database file open that you'd like to check, then the OpenDatabase( ) method
can be used in the default Workspace, as long as no database objects are
going to be modified and saved while the second database is open in shared
mode.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (E-Mail Removed) and (E-Mail Removed)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that questions
answered the quickest are often from those who have a history of rewarding
the contributors who have taken the time to answer questions correctly.


"StuartM" wrote:

> Hi,
>
> Is there any a nice and clean way via VBA to determine if the current user
> has opened the database exclusively?
>
> I have had a problem with the Jet User Roster schema not working when I have
> passed the /Excl command line switch (error 3251 - Object or Provider is not
> capable of performing requested operation). I can catch this command line
> switch without a problem, but I want to cover the possibility that a user has
> opened the database exclusively from the File > Open menu option.
>
> Cheers,
>
> Stuart

 
Reply With Quote
 
=?Utf-8?B?U3R1YXJ0TQ==?=
Guest
Posts: n/a
 
      23rd May 2005
Hi,

I'd tried that and although it works fine I was kind of hoping there may
have been a property exposed somewhere or the other. You've saved me hours of
pointless searching tho'...

Cheers,

Stuart


"'69 Camaro" wrote:

> Hi, Stuart.
>
> > Is there any a nice and clean way via VBA to determine if the current user
> > has opened the database exclusively?

>
> I'd put in error handling to catch the 3251 error whenever it happens, but
> if you'd like another function to do the checking, then create a function
> that uses the OpenDatabase( ) method to open the database in shared mode.
> Create an error handler for this function that handles error numbers 3051 and
> 7866. If either of these error numbers are encountered while opening the
> database programmatically, then the database is either open exclusively or
> the specific file doesn't exist.
>
> If by "current user" you mean the user who has opened the database needs to
> check the current database, then the OpenDatabase method should be used
> within a separately created Workspace object, not the default Workspace
> object. If, on the other hand, the "current user" is any user who has a
> database file open that you'd like to check, then the OpenDatabase( ) method
> can be used in the default Workspace, as long as no database objects are
> going to be modified and saved while the second database is open in shared
> mode.
>
> HTH.
>
> Gunny
>
> See http://www.QBuilt.com for all your database needs.
> See http://www.Access.QBuilt.com for Microsoft Access tips.
>
> (Please remove ZERO_SPAM from my reply E-mail address, so that a message
> will be forwarded to me.)
> Beware to those who use munged addresses: known newsgroup E-mail harvesters
> for spammers are (E-Mail Removed) and (E-Mail Removed)
>
> - - -
> When you see correct answers to your question posted in Microsoft's Online
> Community, please sign in to the Community and mark these posts as "Answers,"
> so that all may benefit by filtering on "Answered questions" and quickly
> finding the right answers to similar questions. Remember that questions
> answered the quickest are often from those who have a history of rewarding
> the contributors who have taken the time to answer questions correctly.
>
>
> "StuartM" wrote:
>
> > Hi,
> >
> > Is there any a nice and clean way via VBA to determine if the current user
> > has opened the database exclusively?
> >
> > I have had a problem with the Jet User Roster schema not working when I have
> > passed the /Excl command line switch (error 3251 - Object or Provider is not
> > capable of performing requested operation). I can catch this command line
> > switch without a problem, but I want to cover the possibility that a user has
> > opened the database exclusively from the File > Open menu option.
> >
> > Cheers,
> >
> > Stuart

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot Open Database Exclusively dan2bhm via AccessMonster.com Microsoft Access Database Table Design 2 14th Sep 2006 11:01 PM
How to Open database exclusively =?Utf-8?B?cmpfYnVkeg==?= Microsoft Access Security 0 15th Jul 2005 06:49 PM
i want to open database exclusively =?Utf-8?B?Q2FybGl0YSBTaWV3?= Microsoft Access 4 5th Dec 2004 06:53 AM
i want to open database exclusively =?Utf-8?B?Q2FybGl0YSBTaWV3?= Microsoft Excel Misc 3 5th Dec 2004 05:24 AM
Open Database Exclusively david epsom dot com dot au Microsoft Access VBA Modules 1 17th May 2004 08:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:49 PM.