aziz rasul
Active member
- Local time
- Today, 17:52
- Joined
- Jun 26, 2000
- Messages
- 1,935
I have a FE db which links to temporary BE db. However when I have created working code, I want to programmatically link to the LIVE BE db and then relink back to the temporary BE db.
I have copied the following code from this forum and experimenting with a couple of Nwind.mdb tables, but get a debug error 3420 i.e. 'Object invalid or no longer set' on the tbldef.Connect = ";DATABASE=" & dbPath line?
I have copied the following code from this forum and experimenting with a couple of Nwind.mdb tables, but get a debug error 3420 i.e. 'Object invalid or no longer set' on the tbldef.Connect = ";DATABASE=" & dbPath line?
Code:
Public Sub reLinkTables(dbPath As String)
Dim tbldef As DAO.TableDef
Dim tblName As Variant
Dim arrTables As Variant
arrTables = Array("Employees", "Shippers")
For Each tblName In arrTables
Set tbldef = CurrentDb.TableDefs(tblName)
tbldef.Connect = ";DATABASE=" & dbPath
tbldef.RefreshLink
Next tblName
End Sub