Reputation: 160
I've recently learned how to link tables from MySQL to MS access database using OBDC connection but I have the following problem:
The application I am building will have increasing number of tables going to a couple of thousands. I want to create tables in the SQL database using VBA in MS Access.
How can I automatically link those new tables to the Access application right when I create them in the SQL db?
Is this sort of connection the best to use in my case?
Upvotes: 0
Views: 1283
Reputation:
In the same routine where you create the table you should be able to link them to the Access-Project you're in like this:
Dim db As DAO.Database
Set db = CurrentDb()
db.TableDefs("yourTable").Connect = _
"ODBC;DSN=yourDSN;SERVER=yourServer;" & _
"PORT=3306;OPTION=12345;" & _
"DATABASE=yourDB;USER=yourUserName;" & _
"PASSWORD=yourPassword"
db.TableDefs("yourTable").RefreshLink
Find some more useful information here
Upvotes: 1