Need help ......... going round in circles and getting dizzy ..
I have an Access System, use a single folder that holds three databases, all exactly the same tables and structure except for data. One is a working database, one is a test database and the third is a training database. My data is held separate to my code obviously.
I come in through a basic menu where I select which database I want, then set up the database name via a common module (public parameter) which worked fine in my test using a single database already linked into my code .mdb.
Next step was to de-link the files when I exit from my system and that works well.
Now comes to linking in the required tables from the selected database when I start up.
All three databases are in a folder - c:\mysystem\datasystem.mdb, c:\mysystem\datatest.mdb and c:\mysystem\datatrain.mdb.
I require to link in all the tables in the selected database and have scoured forums, etc but am having no luck, probably through a level of ignorance in getting it working from various examples. Just need a simple solution to link back in.
My code for deleting when I exit is as follows and works perfect but I now need the reverse of it.
Dim tdf As DAO.TableDef
For Each tdf In CurrentDb.TableDefs
' If the table has a connect string, it's a linked table.
If Len(tdf.Connect) > 0 Then
DoCmd.DeleteObject acTable, tdf.Name
End If
Next tdf
Can anyone help please, many thanks.