MS access 2010 ODBC connection to MySQL

纵然是瞬间 提交于 2019-12-25 02:46:55

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/23891716/ms-access-2010-odbc-connection-to-mysql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!