I struggled with this for several days. Any help is greatly appreciated.
Attempting to connect to a MySQL database using Excel VBA on a PC with the following:
Excel 2007 Windows 7 x64 Home Premium MySQL 5.5 MySQL ODBC Connector 5.1, 64 bit
In Excel VBA, I reference the Microsoft ActiveX Objects 2.8 library.
The VBA that I use to connect:
Dim oConn As ADODB.Connection Public Sub ConnectDB() Set oConn = New ADODB.Connection oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=localhost;" & "DATABASE=test;" & "USER=root;" & "PASSWORD=PWhere;" & "Option=3" End Sub
Every time I run this, I get a dialog box with the error: "[Microsoft] [ODBC driver manager] Data source name not found, and default driver not specified"
MySQL service is definitely working.
I used the Windows Data Source Administrator to verify that the MySQL ODBC Connector 5.1 is present and fixed: it checks OK when I try to create a DSN this way.
Looking through the link options for the VBA project, I mark the link options for the entire set of different ADO libraries, including the (multidimensional) parameters and versions of the libraries 2.0.2.1, 2.5.5.2.6.2.7 and 6.0, maybe the answer lies in one of them?
More details are required, let me know.
source share