Hello - I am trying to modify the Connect property of every table in an Access DB w/ linked tables.
I need to modify the connect string to represent a change in server name, but when I tried a simple test, I receive an error: "Invalid Operation"
Here's my test procedure:
Sub DefConSet()
Dim strCon As String
strCon = "TESTING"
Dim db As Database
Dim td As TableDef
Set db = CurrentDb
For Each td In db.TableDefs
'Debug.Print td.Connect
td.Connect = strCon
Next td
Set db = Nothing
End Sub
Before I did this test, I tried doing it by using the previous connect property value, slightly modified, in the strCon variable. I received the same error, so I don't think it's the fact that I am trying to set the connect property to "TESTING". I maybe wrong?
Anyways, thanks in advance for the help.
I am hoping it is possible to modify the connect properties of all tabledefs in the TableDefs collection using some sort of loop, but I am very new to all this stuff!
I need to modify the connect string to represent a change in server name, but when I tried a simple test, I receive an error: "Invalid Operation"
Here's my test procedure:
Sub DefConSet()
Dim strCon As String
strCon = "TESTING"
Dim db As Database
Dim td As TableDef
Set db = CurrentDb
For Each td In db.TableDefs
'Debug.Print td.Connect
td.Connect = strCon
Next td
Set db = Nothing
End Sub
Before I did this test, I tried doing it by using the previous connect property value, slightly modified, in the strCon variable. I received the same error, so I don't think it's the fact that I am trying to set the connect property to "TESTING". I maybe wrong?
Anyways, thanks in advance for the help.
I am hoping it is possible to modify the connect properties of all tabledefs in the TableDefs collection using some sort of loop, but I am very new to all this stuff!