Refreshing links via VB code to a database with known PASSWORD

D

Doug

Ok, I'm stuck. I have a main Access database with links to another.

I have a routine that successfully resets the database links below.

The PROBLEM is, that when I added PASSWORDS to each database, it won't reset
the link.

Any help would be GREATLY appreciated

Doug

'--- original code to refresh links ---
For Each tbl In cat.Tables
' Loop through all tables. SKIP the SYSTEM tables as well as
non-linked tables
If UCase(Left(tbl.Name, 4)) = "MSYS" Then GoTo GetNextTable
If tbl.Properties("Jet OLEDB:Create Link").Value = False Then GoTo
GetNextTable
' QUERIES have a link, but won't have a 'Link Database' or "Remote
Table "Name"
If tbl.Properties("Jet OLEDB:Link Datasource").Value = "" Then GoTo
GetNextTable


Msg = "Table = " & tbl.Name
For i = 0 To tbl.Properties.Count - 1
Msg = Msg & vbCr & vbTab
Msg = Msg & tbl.Name & " - (" & tbl.Properties(i).Name & ") = "
& tbl.Properties(i).Value
Next
'MsgBox Msg

' Get the CORE Link Datasource filename, withOUT the path
S = tbl.Properties("Jet OLEDB:Link Datasource").Value '
C:\Clients\...
' get JUST the database core NAME, withOUT the path
i = InStrRev(S, "\")
dbFile = dPath & Mid(S, i + 1)
' Now Build the new ..Path\CoreFileName
tbl.Properties("Jet OLEDB:Link Datasource").Value = dbFile

GetNextTable:
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top