Failing to connect with ADO.

Connecting using ADO in VBA / Excel.

I've done the ado stuff before .... 5 years ago so I'm a bit rusty. Installed MySQL on my laptop and trying to work with DBases again.

I know that you had to do something in the "Control Panel" Administrative settings I've got the following done.

  1. The drivers show up on the "Drivers Tab" in the administrator section
  2. Created entries in the File DSN and System DSN ( the test says connection successful )

However, now trying to connect to the MySQL database with ado and I keep getting this error.

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

The following is the code in VBA.

Private Sub ConnectDB()

Set oConn = New ADODB.Connection
oConn.Open "Provider=MSDASQL;DRIVER={MySQL ODBC 5.3 ANSI Driver};" & _
    "SERVER=localhost;" & _
    "DATABASE=randomnames;" & _
    "USER=root;" & _
    "PASSWORD=xxxxxxxx.2010;" & _
    "Option=3"

End Sub

Sorry if code needs tags .... can't see where to select them from.

0 answers