Opening External database on Shared drive

lcook1974

Registered User.
Local time
Today, 14:59
Joined
Dec 21, 2007
Messages
330
Hi All,
I am looking to create a form that will open different database on a shared drive...but I keep getting this error:

"Microsoft Office Can't open because its missing or opened exclusivly by another user"

The code below works fine for the database on my computer
(C:\Documents and Settings\lcook11\Desktop\DB's_IN_Progress) but I need it to point to a folder on shared network.

Code:
Private Sub cmdOpenTCImprovements_Click()
' Include the following in Declarations section of module.
Dim appAccess As Access.Application

    Dim strDB As String
    ' Initialize string to database path.
    Const strConPathToSamples = "P:\Transplant Connect"
    strDB = strConPathToSamples & "TC_Improvements.mdb"
    ' Create new instance of Microsoft Access.
    Set appAccess = _
        CreateObject("Access.Application")
    ' Open database in Microsoft Access window.
    appAccess.OpenCurrentDatabase strDB
    ' Open Orders form.
    appAccess.DoCmd.OpenForm "frm_Main"
End Sub

Any suggestions?

Thanks
Larry
 
Sounds like a network rights issue rather than a coding issue.

Are you sure you have read/write access to the network folder the database is in?

Mike.
 
Yes..everyone who will be using the database has access to the shared drive.

I was thinking after I posted it that I probably need to get the full path to the server and put that in there instead of the just the "P:drive"

Thanks for the quick response though.. :)

I'll let you know how that works out tomorrow.

Larry
 
Yes I wold look at the UNC file path format first, as like you say the mapped drive may differ from machine to machine
 
okay so I got the correct path...the code seems to be working but it didn't "open the database". When I looked in the folder where the database is, it had the little icon like it was open but I couldn't see it.

I recieved no error messages.

Same code as before except the path is correct now.

Any ideas?
 
okay so after looking through some related links...this works much better.

application.followhyperlink "...." (THANK YOU MR. LARSON!...it was from your thread)

Larry
 
Nobody will read this post as the issue has been resolved, but just in case anyone does. Did anyone notice that in the original post there was a \ missing in the path(!) between the Const and mdb name?

Const strConPathToSamples = "P:\Transplant Connect"
strDB = strConPathToSamples & "TC_Improvements.mdb"

David
 
I would just like to point out that opening a database on a shared drive is a BAD idea. In my experience this is the fastest way to corrupt your database.

What happens when two people open it at the same time? Whenever I need to share data I use the FE / BE method.
 

Users who are viewing this thread

Back
Top Bottom