MS Access 2010与MySQL的ODBC连接 [英] MS access 2010 ODBC connection to MySQL

查看:63
本文介绍了MS Access 2010与MySQL的ODBC连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近学习了如何使用OBDC连接将表从MySQL链接到MS Access数据库,但存在以下问题:

I've recently learned how to link tables from MySQL to MS access database using OBDC connection but I have the following problem:

我正在构建的应用程序将具有越来越多的表,这些表将达到几千个.我想在MS Access中使用VBA在SQL数据库中创建表.

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.

在SQL数据库中创建新表时,如何将这些新表自动链接到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?

推荐答案

在创建表的同一例程中,您应该能够将它们链接到您所在的Access-Project中:

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

此处

这篇关于MS Access 2010与MySQL的ODBC连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆