Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Link via UNC in Windows XP?

Status
Not open for further replies.

RobTsintas

Technical User
May 17, 2001
58
GB
(Using Access 97 on a Windows XP machine)

I have a problem with updating linked tables which other users have to use. I cannot refresh the link using my drive mapping (B:) because other users don't all have the same mapping, so I must use the full network address instead.

This was fine on my previous Windows NT machine, as I could use the Linked Table Manager and navigate through Network Neighborhood.

Now, in Windows XP, Network Neighbourhood is gone and, even though I added the location under My Network Places, it doesn't appear there in the browse window. The only way to navigate to the network folder is through the mapped drive letter, which I don't want to do!

I eventually managed to get round the problem by creating a shortcut to the folder via it's network address and following the shortcut in the browse window. But surely there's got to be a better way.......

Any ideas?

Thanks
 
Here is an example of some code that I have used in the past to remap a database with consideration given to wether it is a hard letter map or a UNC mapping. You will have to modify it to fit your situation but it could get you started in the right direction.

Code:
Dim dbCurrent As Database, TmpTable As TableDef
Dim I As Integer, vServerID as String
Dim vResponse As Integer
Dim vUNCorHardMap As Integer
vServerID = [RED][i]serverID[/I][/RED]
Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
For I = 0 To dbCurrent.TableDefs.Count - 1
    Set TmpTable = dbCurrent.TableDefs(I)
    If TmpTable.Connect <> "" Then
        vUNCorHardMap = InStr(1, TmpTable.Connect, "\\")
        If vUNCorHardMap > 0 Then
            If InStr(1, TmpTable.Connect, "\data\") > 0 Then
                TmpTable.Connect = ";DATABASE=" & vServerID & "\data" & Mid$(TmpTable.Connect, (InStr(1, TmpTable.Connect, "\data\") + 5))
            Else
                TmpTable.Connect = ";DATABASE=" & vServerID & "\data" & Mid$(TmpTable.Connect, (InStr(1, TmpTable.Connect, "_") + 2))
            End If
            TmpTable.RefreshLink
        Else
            If InStr(1, TmpTable.Connect, "g:") > 0 Then
                TmpTable.Connect = ";DATABASE=" & vServerID & ":\" & Mid$(TmpTable.Connect, (InStr(1, TmpTable.Connect, "g:") + 3))
                TmpTable.RefreshLink
            End If
        End If
    End If
Next I

There are some site specifics that are embedded in here as we were using a file of LMHostID's with the format ASxxxx_01 as a serverID. You identification would be different and you can modify the code to look for specifics that indicate a HardMap vs a UNC mapping. Because both kinds of files exist on our systems I had to compensate for both here.

Post back if you have any questions.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Rob,

I share your frustration.

I typically just type in the link via the browse window. So when It prompts me for file name I type in: \\server1\
and then hit enter, then I browse through and find the .mdb and it stores it with UNC.

If you store the FRONT end with UNC you will be the only person creating this link.. users won't have to do it.

Kramerica
[roll1]
 
Thanks for your suggestions.

Scriverb: I have saved your code and will hopefully have a chance to adapt and incorporate something at some point. It's just so hard to find time to work on development (and as soon as you do, all the rules change and you have to start over!)

Kramerica: That's a real help. I hadn't considered this, as I assumed you'd have to type the server name in the address bar (which is just a drop-down in the browse window and so doesn't accept typing). But putting it into the filename box to browse there works great. At least I know I can do this until I'm able to incorporate some code.

Thanks again!
 
One more thing, as the code that I copied and pasted was from a previously designed database. Make sure you make your declaration using the DAO designation.

Code:
Dim dbCurrent As DAO.Database, TmpTable As DAO.TableDef

And make sure a reference has been made in your database to the appropriate MS DAO Object Library.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top