Trying to debug a little test code. I need to temporarily link to a table in a different db other than the currentdb. I get a Type Mismatch on the TableDef name assignment so there's obviously something I don't know about TableDef objects.
Code:
Option Compare Database
Option Explicit
Const TMSHub As String = "c:\eRep\eRepData.mdb"
Private Sub testlink()
LinkTMS ("AC530")
End Sub
Private Function LinkTMS(tblName As String)
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
' Link to tblName on the TMS Hub
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Dim tdf As DAO.TableDef
Set tdf = tblName
tdf.Connect = "; DATABASE=" & TMSHub 'Yes, specify new BE
Set tdf = Nothing
End Function
I also tried to include the table name in the tdf.Connect, but that doesn't work either.
Code:
'Set tdf = tblName
tdf.Connect(tblName) = "; DATABASE=" & TMSHub