Simulate link to network path

snoopy2003

Registered User.
Local time
Today, 14:11
Joined
Aug 26, 2012
Messages
13
Hello,

I have a front end and a back end access files.
My user save the back end on a shared network folder like:
\\a.b.com\folderName$
I wish to simulate this path in my local pc in order to set the linked table links.
My problem is that I can not modify my pc name to be "a.b.com".

How can I simulate this in my windows 7 pc
so I can set the linked table values to "\\a.b.com\folderName$" ?

Thank you for your help
 
This is the code I use to relink tables. However this code only works if it "sees" the new database, so you will need to tweek it a little to get it to work for you.

Code:
Private Sub cmdRelink_Click()
Dim strFolder As String, strDBName As String
Dim intParam As Integer, intErrNo As Integer
Dim strOldLink As String, strOldName As String
Dim strNewLink As String
Dim varLinkAry As Variant
Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CurrentDb
 
If Nz(Me.txtFilePath, "") = "" Then
    strFolder = CurrentProject.Path
ElseIf Right(Me.txtFilePath, 1) = "\" Then
    strFolder = Left(Me.txtFilePath, Len(Me.txtFilePath) - 1)
Else
    strFolder = Me.txtFilePath
End If
 
For Each tdf In db.TableDefs
    With tdf
        If .Attributes And dbAttachedTable Then
            varLinkAry = Split(.Connect, ";")
            For intParam = LBound(varLinkAry) To UBound(varLinkAry)
                If Left(varLinkAry(intParam), 9) = "DATABASE=" Then
                    Exit For
                End If
            Next intParam
            strOldLink = Mid(varLinkAry(intParam), 10)
            strDBName = Split(strOldLink, "\")(UBound(Split(strOldLink, "\")))
            strDBName = Left(strDBName, Len(strDBName) - 6) & ".accdb"
            strNewLink = strFolder & "\" & strDBName
            strOldName = Split(strOldLink, "\")(UBound(Split(strOldLink, "\")))
            If strOldName = strDBName Then
                varLinkAry(intParam) = "DATABASE=" & strNewLink
                .Connect = Join(varLinkAry, ";")
                On Error Resume Next
                Call .RefreshLink
                intErrNo = Err.Number
                On Error GoTo 0
            End If
        End If
    End With
Next tdf
 
MsgBox "All tables have been relinked" & Chr(13) & "Please verify the file paths are correct"
End Sub
 
Hello,

Thank you for your useful code.
I have a code for updating tables links.
I wish to define the network path in my pc.
If the path was \\pcName\shareFolderName I could modify my pc name to "pcName", create shared folder named "shareFolderName" and update the access table links to "\\pcName\shareFolderName".
My problem is that the network path contains dot chars: "\\a.b.com\folderName$"
and I can not rename my pc to such name.
I tried to update the HOST file in windows by adding:
192.168.1.100 a.b.com
and define a shared folder named: "folderName$".
When I tried to map a network place to "\\a.b.com\folderName$" I got user/password prompt and my account password was not excepted.

How can I simulate "\\a.b.com\folderName$" network path on windows 7 ?

Thank you for your help
 
Prompt user for network path if linked tables not found and relink the tables from code
 
Hello,

Thank you for your answer. I prompt the user if he needs to update the table links but I wish to 'set' the same environment in my local pc.

Thank you for your help
 
I seem to be missing the point. Why can't you simply point to a local file to test and develop, then change the links to the correct path to distribute?
 
Hello,

When I relink the tables using the network path I get an error in the "Tdf.RefreshLink"
command (because the target file does not exist) and I can not save the modified front end.

Thank you for your help
 
Hello,

At last, I understand how to do it.
I saved the network path in a local table and add a module
that tries to relink to this path on start up
(using a code similar to your suggested code).

Thank you very much for your support
 

Users who are viewing this thread

Back
Top Bottom