I am writing a simple VBA that inserts a query to my local MySQL database.
With Mysql ODBC Connector 64bit Installed.
Private Sub CommandButton1_Click()
Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Set c = New ADODB.Connection
strCon = "Driver={MySQL ODBC 5.1 Driver};SERVER=127.0.0.1;DATABASE=DATABASENAME;UID=USER;PWD=PASSWORD"
Dim rw As Integer
c.Open strCon
sq = "INSERT INTO `DATABASE`.`TABLE` (`ID`, `title`) VALUES ('1', 'SOMETITLE');"
Set r = c.Execute(sq)
c.Close
End Sub
And added the reference
Tools > References >"Microsoft ActiveX Data Objects 2.5 Library"
When I test it it gives me the error below
Run-time error '-2147467259 (80004005)':
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
When I install Mysql ODBC Connector 32bit everything works.
Yet, my question is Why would the 32 bit work? Despite my system is 64 bits and MySQL is also 64 bit . Why would the 64 bit version giving me such error, yet 32 bit worked?