I have four linked tables within my access db; i need to change the connection string; of course i can refresh by the menu (linked table manager) and choose the right odbc-connection, but i want to be able to do this for the four tables at once by a button.
At this moment i have made a local table in which i have three fields,
1st field: tablename (name of the table)
2nd field: connection string at the moment (datafilepath)
3rd field: connection string to be (PathToBe)
In following code i first pick the first table (for testing purposes)
to change the connectivity.
I debug this by in the immediate window calling the function (also for testing purposes); however i get an error by letting this function run (3011 syaing "The microsoft Jet Database engine could not find the object '<<TABLENAME>>'. Make sure the object exists and that you spell its name and the path name correctly", with of course the buttons END and DEBUG.
I think one of the problems is that the databasename (for example db_tst) is mentioned in the actual tablename.
Example:
real tablename is db_tst.tblName
linked name: tblName
My question? How to cope with it, i can't seem to get it work, the connection string isn't changing.....
Thanks for your answers/reactions!
At this moment i have made a local table in which i have three fields,
1st field: tablename (name of the table)
2nd field: connection string at the moment (datafilepath)
3rd field: connection string to be (PathToBe)
In following code i first pick the first table (for testing purposes)
to change the connectivity.
I debug this by in the immediate window calling the function (also for testing purposes); however i get an error by letting this function run (3011 syaing "The microsoft Jet Database engine could not find the object '<<TABLENAME>>'. Make sure the object exists and that you spell its name and the path name correctly", with of course the buttons END and DEBUG.
I think one of the problems is that the databasename (for example db_tst) is mentioned in the actual tablename.
Example:
real tablename is db_tst.tblName
linked name: tblName
My question? How to cope with it, i can't seem to get it work, the connection string isn't changing.....
Thanks for your answers/reactions!
Code:
Function a() 'voor de test
Dim db As DAO.Database
Dim qry As DAO.QueryDef
Dim rst As DAO.Recordset
Dim tbl As DAO.TableDef
Set db = CurrentDb
Set rst = db.OpenRecordset("tblLinkedTables")
Set tbl = db.TableDefs(rst!TableName)
tbl.RefreshLink
End Function