Open MySQL ODBC Connection...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have managed to succesfully link a MySQL table through Access 2000 but when
I try to connet to update the table through VBA I get prompted to enter a
user ID and PW by the MySQL ODBC Driver. I would like to bypass this prompt
by openning the connection prior to running the updates but my code below
gives me an error on "oConn.Open" = [Microsoft][ODBC Driver Manager] Data
source name not found and no default driver specified;

CODE:
Option Compare Database

Const strMySQL As String = "ODBC;FILEDSN=C:\Documents and Settings\User1\My
Documents\rates.dsn;" & _
"Uid=******;" & _
"Pwd=*****"



Private Sub Form_Load()

Dim oConn As New ADODB.Connection

oConn.connectionString = strMySQL
oConn.ConnectionTimeout = 0
oConn.Open
....


The Access database and the MySQL DSN are on my machine and I am the only
user. Also I'm
sure that it works since I used the same DSN to link the table in the local
Access database where I am attempting to run this code...Thank you in advance
for you help
 
Looks like you have got ODBC and OLEDB connection strings mixed up.

Your OLEDB connection string will specify that the OLEDB ODBC provider is
the one you want.
 
Looks like you have got ODBC and OLEDB connection strings mixed up.

Your OLEDB connection string will specify that the OLEDB ODBC provider is
the one you want.


AccessARS said:
I have managed to succesfully link a MySQL table through Access 2000 but when
I try to connet to update the table through VBA I get prompted to enter a
user ID and PW by the MySQL ODBC Driver. I would like to bypass this prompt
by openning the connection prior to running the updates but my code below
gives me an error on "oConn.Open" = [Microsoft][ODBC Driver Manager] Data
source name not found and no default driver specified;

CODE:
Option Compare Database

Const strMySQL As String = "ODBC;FILEDSN=C:\Documents and Settings\User1\My
Documents\rates.dsn;" & _
"Uid=******;" & _
"Pwd=*****"



Private Sub Form_Load()

Dim oConn As New ADODB.Connection

oConn.connectionString = strMySQL
oConn.ConnectionTimeout = 0
oConn.Open
...


The Access database and the MySQL DSN are on my machine and I am the only
user. Also I'm
sure that it works since I used the same DSN to link the table in the local
Access database where I am attempting to run this code...Thank you in advance
for you help
 
Back
Top