I have some code that links tables to a backend, MS Access DB 2007. I am looking for assitance to have the code check to see if the table is already linked, and if it is linked then don't do anything. If The table is not linked, then link the table.
I check for system tables (MSys) and tmp (~) tables and do not link them.
Any assistance is appreciated.
here is the code:
Code:
numTables = DBEngine.Workspaces(0).OpenDatabase(strPath).TableDefs.count -1
for i = 0 to numTables
tabName = DBEngine.Workspaces(0).OpenDatabase(strPath).TableDefs(i).Name
if InStr(1, tabName, "msys") = False And _
InStr(1, tabName, "~") = False Then
lst.AddItem DBEngine.Workspaces(0).OpenDatabase(strPath).TableDefs(i).Name
if CurrentDB.TableDefs(i).Name = "" Then 'Table does not exist in the front end so link it.
Docmd.TransferDatabase .....etc
end if
end if
Next
Thanks,
Ken