UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Dao Connection With Absolute Network Path, Access 2016    
 
   
allen_edgar
post Jul 10 2018, 01:48 AM
Post#1



Posts: 21
Joined: 7-May 17



Have a problem connecting to backend database where I know the absolute network path but not the client’s mapped path which may not even exists.

For example:
Absolute path: “\\SERVERA\I:\CMMS Microsoft Access\Data”
Mapped drive to same location: “E:\CMMS Microsoft Access\Data”

Dim rst As Recordset
Dim wrk As DAO.Workspace
Dim dbs As DAO.Database
Dim BackEndDb As String, backEndPath As String

‘This works OK with mapped drive path
1. backEndPath = “E:\CMMS Microsoft Access\Data” 'mapped drive
2. BackEndDb = backEndPath + "\CMMSCommon.accdb"
3. Set wrk = DBEngine(0)
4. Set dbs = wrk.OpenDatabase(BackEndDb)

‘This fails at line 4 with error 3055 "Not a valid file name"
1. backEndPath = “\\SERVERA\I:\CMMS Microsoft Access\Data” 'absolute path
2. BackEndDb = backEndPath + "\CMMSCommon.accdb"
3. Set wrk = DBEngine(0)
4. Set dbs = wrk.OpenDatabase(BackEndDb)

I have the same problem when trying to use RefreshLinks
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef

Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
tdf.Connect = ";DATABASE=" & BackEndDb 'this line fails if BackEndDb begins with "\\"

How can I accomplish the connections without know the client's mapped drive letter?
Go to the top of the page
 
JonSmith
post Jul 10 2018, 02:32 AM
Post#2



Posts: 3,582
Joined: 19-October 10



Hi,

First of all, to get the vernacular correct, E:\CMMS Microsoft Access\Data would be considered an absolute path. It always points to the same location. The other option is a relative path which will change based on the 'working' folder. The term you are looking for to describe a path with a drive letter mapping is UNC path.


QUOTE
\\SERVERA\I:\CMMS Microsoft Access\Data


This is not an UNC path. Try for example pasting that into the Folder Explorer. It will be invalid. The I:\ part is off. You are mixing in a mapped path with a UNC path. The reason I know this for sure is that a folder cannot have a ':' in it.
Get the correct UNC path and it'll work.

JS
Go to the top of the page
 
allen_edgar
post Jul 10 2018, 03:06 AM
Post#3



Posts: 21
Joined: 7-May 17



Thanks for the quick reply. Yes, it was the ":" in "I:" that was causing the error. Problem resolved.
This post has been edited by allen_edgar: Jul 10 2018, 03:08 AM
Go to the top of the page
 
JonSmith
post Jul 10 2018, 03:47 AM
Post#4



Posts: 3,582
Joined: 19-October 10



Happy to help, have continued success in your project.

JS
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd July 2018 - 05:53 AM