Linked table manager

G

Guest

I am trying to relink my tables. I'm getting the message "Invalid Procedure
Call or Argument." All I can say is OK. I can't get to the link menu. Any
ideas folks? I'm using Access 97. Otherwise the database works just fine.
 
G

Guest

I use this funciton. I have only used it in XP Pro.
It only changes the link. It will NOT add or subtract links.

Function linkmetest()
Rem JetTable = Access table
Call linkme("C:\CLEARWIN\BACKEND.MDB", "AGENCIES")
Call linkme("C:\CLEARWIN\BACKEND.MDB", "CEASEDPUBS")
Call linkme("C:\CLEARWIN\BACKEND.MDB", "CLEAR_DATE_LIST")
Call linkme("C:\CLEARWIN\COA_CANCELBACKEND.MDB", "COA_CANCEL")
Call linkme("C:\CLEARWIN\COA_CANCELBACKEND.MDB", "CPPASSWORD")
Call linkme("C:\CLEARWIN\TRANSFERBACKEND.MDB", "DONE")
Call linkme("C:\CLEARWIN\HISTORY.MDB", "HISTORY")
Call linkme("C:\CLEARWIN\BACKEND.MDB", "MAGINFO")
Call linkme("C:\CLEARWIN\HISTORY.MDB", "ORDSUM")
Call linkme("C:\CLEARWIN\COA_CANCELBACKEND.MDB", "PASSWORD")

End Function


Function linkmelive()
Rem link table to live database.
Call linkme("T:\CLEARWIN\BACKEND.MDB", "AGENCIES")
Call linkme("T:\CLEARWIN\BACKEND.MDB", "CEASEDPUBS")
Call linkme("T:\CLEARWIN\BACKEND.MDB", "CLEAR_DATE_LIST")
Call linkme("T:\CLEARWIN\COA_CANCELBACKEND.MDB", "COA_CANCEL")
Call linkme("T:\CLEARWIN\COA_CANCELBACKEND.MDB", "CPPASSWORD")
Call linkme("T:\CLEARWIN\TRANSFERBACKEND.MDB", "DONE")
Call linkme("T:\ACCESSFILES\HISTORY.MDB", "HISTORY")
Call linkme("T:\CLEARWIN\BACKEND.MDB", "MAGINFO")
Call linkme("T:\ACCESSFILES\HISTORY.MDB", "ORDSUM")
Call linkme("T:\CLEARWIN\COA_CANCELBACKEND.MDB", "PASSWORD")

End Function

Function linkme(strDatabase As String, strNewTable As String)
Dim dbs As Database
Dim tdf As TableDef

Set dbs = CurrentDb()

For Each tdf In dbs.TableDefs
Rem use only the linked tables
If Len(tdf.Connect) > 0 Then
Rem this is a linked table

Rem if this is the name of the table.
Rem then change the database location.
If tdf.NAME = strNewTable Then
tdf.Connect = ";database=" & strDatabase
tdf.RefreshLink
End If

Else
Rem not a connected table
End If
Next tdf

Rem cleanup
Set tdf = Nothing
Set dbs = Nothing

End Function

Scott Burke
 

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