dbTalk Databases Forums  

OpenCurrentDatabase using UNC for pathname

comp.databases.ms-access comp.databases.ms-access


Discuss OpenCurrentDatabase using UNC for pathname in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob Darlington
 
Posts: n/a

Default OpenCurrentDatabase using UNC for pathname - 10-25-2010 , 02:01 AM






I'm using the following code in Access 2002 to open a report in an external
db.

Dim objAccess As Access.Application
Set objAccess = New Access.Application
With objAccess
.OpenCurrentDatabase "\\server\dpcman\cheques.mdb"
.DoCmd.OpenReport strReport, acViewPreview, , , , gblPropNum
End With

An error 7866 (Can't open the database because it is missing or opened
exclusively by another user...") is generated at the line
".OpenCurrentDatabase.."
If I substitute that line for:
.OpenCurrentDatabase "c:\dpc manager 10\cheques.mdb" (which on my
development PC is the same path)
it works fine.

The Help screen for 'OpenCurrentDatabase' indicates that UNC can be used.
Is there any reason I can't use UNC in this context?
If so, is there a way to resolve the UNC path to generate the mapped path?

--
Bob Darlington
Brisbane

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: OpenCurrentDatabase using UNC for pathname - 10-25-2010 , 04:10 AM






Bob Darlington wrote:
Quote:
I'm using the following code in Access 2002 to open a report in an external
db.

Dim objAccess As Access.Application
Set objAccess = New Access.Application
With objAccess
.OpenCurrentDatabase "\\server\dpcman\cheques.mdb"
.DoCmd.OpenReport strReport, acViewPreview, , , , gblPropNum
End With

An error 7866 (Can't open the database because it is missing or opened
exclusively by another user...") is generated at the line
".OpenCurrentDatabase.."
If I substitute that line for:
.OpenCurrentDatabase "c:\dpc manager 10\cheques.mdb" (which on my
development PC is the same path)
it works fine.

The Help screen for 'OpenCurrentDatabase' indicates that UNC can be used.
Is there any reason I can't use UNC in this context?
If so, is there a way to resolve the UNC path to generate the mapped path?

Maybe the UNC path is incorrect?
http://www.wiredbox.net/forum/Thread..._drive_le.aspx

Reply With Quote
  #3  
Old   
Bob Barrows
 
Posts: n/a

Default Re: OpenCurrentDatabase using UNC for pathname - 10-25-2010 , 10:33 AM



Bob Darlington wrote:
Quote:
I'm using the following code in Access 2002 to open a report in an
external db.

Dim objAccess As Access.Application
Set objAccess = New Access.Application
With objAccess
.OpenCurrentDatabase "\\server\dpcman\cheques.mdb"
.DoCmd.OpenReport strReport, acViewPreview, , , ,
gblPropNum End With

An error 7866 (Can't open the database because it is missing or opened
exclusively by another user...") is generated at the line
".OpenCurrentDatabase.."
If I substitute that line for:
.OpenCurrentDatabase "c:\dpc manager 10\cheques.mdb" (which on
my development PC is the same path)
it works fine.

The Help screen for 'OpenCurrentDatabase' indicates that UNC can be
used. Is there any reason I can't use UNC in this context?
Nope. The permissions on the share you are using might not be allowing
the ldb file to be created/modified ...

--
HTH,
Bob Barrows

Reply With Quote
  #4  
Old   
Bob Darlington
 
Posts: n/a

Default Re: OpenCurrentDatabase using UNC for pathname - 10-25-2010 , 06:18 PM



Thanks Salad. I had tested that with Dir() and all is OK.


--
Bob Darlington
Brisbane
"Salad" <salad (AT) oilandvinegar (DOT) com> wrote

Quote:
Bob Darlington wrote:
I'm using the following code in Access 2002 to open a report in an
external db.

Dim objAccess As Access.Application
Set objAccess = New Access.Application
With objAccess
.OpenCurrentDatabase "\\server\dpcman\cheques.mdb"
.DoCmd.OpenReport strReport, acViewPreview, , , , gblPropNum
End With

An error 7866 (Can't open the database because it is missing or opened
exclusively by another user...") is generated at the line
".OpenCurrentDatabase.."
If I substitute that line for:
.OpenCurrentDatabase "c:\dpc manager 10\cheques.mdb" (which on my
development PC is the same path)
it works fine.

The Help screen for 'OpenCurrentDatabase' indicates that UNC can be used.
Is there any reason I can't use UNC in this context?
If so, is there a way to resolve the UNC path to generate the mapped
path?

Maybe the UNC path is incorrect?
http://www.wiredbox.net/forum/Thread..._drive_le.aspx

Reply With Quote
  #5  
Old   
Bob Darlington
 
Posts: n/a

Default Re: OpenCurrentDatabase using UNC for pathname - 10-25-2010 , 07:15 PM



I think the problem is solved.
I was testing the code on my development PC which is also the 'server' so
that the UNC path (which tests OK) doesn't seem to like refering to a UNC
address which is on the same PC.
I tested the same thing on a network from another PC and all is well.
Thanks for your replies.

--
Bob Darlington
Brisbane
"Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote

Quote:
I'm using the following code in Access 2002 to open a report in an
external db.

Dim objAccess As Access.Application
Set objAccess = New Access.Application
With objAccess
.OpenCurrentDatabase "\\server\dpcman\cheques.mdb"
.DoCmd.OpenReport strReport, acViewPreview, , , , gblPropNum
End With

An error 7866 (Can't open the database because it is missing or opened
exclusively by another user...") is generated at the line
".OpenCurrentDatabase.."
If I substitute that line for:
.OpenCurrentDatabase "c:\dpc manager 10\cheques.mdb" (which on my
development PC is the same path)
it works fine.

The Help screen for 'OpenCurrentDatabase' indicates that UNC can be used.
Is there any reason I can't use UNC in this context?
If so, is there a way to resolve the UNC path to generate the mapped path?

--
Bob Darlington
Brisbane

Reply With Quote
  #6  
Old   
Salad
 
Posts: n/a

Default Re: OpenCurrentDatabase using UNC for pathname - 10-25-2010 , 07:21 PM



Bob Darlington wrote:

Quote:
Thanks Salad. I had tested that with Dir() and all is OK.


The UNC path is correct or you can open the database with the UNC path?

If not, you could get the drive letter from the UNC path (at load up
time) and substitue that instead of the UNC path.

Reply With Quote
  #7  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: OpenCurrentDatabase using UNC for pathname - 10-26-2010 , 02:42 PM



"Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote in
news:4cc61db8$0$25361$afc38c87 (AT) news (DOT) optusnet.com.au:

Quote:
I was testing the code on my development PC which is also the
'server' so that the UNC path (which tests OK) doesn't seem to
like refering to a UNC address which is on the same PC.
I have never seen that. I do note that sometimes Windows Explorer
will convert a UNC path to its local equivalent (which is quite
annoying), but that's Windows Explorer, and not really relevant to
how Access/Jet/ACE handles UNC paths.

There might be firewall settings that interfere with it, though.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #8  
Old   
Bob Darlington
 
Posts: n/a

Default Re: OpenCurrentDatabase using UNC for pathname - 11-02-2010 , 05:32 PM



Thanks David.
I'll recheck the firewall settings.

--
Bob Darlington
Brisbane
"David-W-Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote

Quote:
"Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote in
news:4cc61db8$0$25361$afc38c87 (AT) news (DOT) optusnet.com.au:

I was testing the code on my development PC which is also the
'server' so that the UNC path (which tests OK) doesn't seem to
like refering to a UNC address which is on the same PC.

I have never seen that. I do note that sometimes Windows Explorer
will convert a UNC path to its local equivalent (which is quite
annoying), but that's Windows Explorer, and not really relevant to
how Access/Jet/ACE handles UNC paths.

There might be firewall settings that interfere with it, though.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.