Open MySQL ODBC Connection...

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
 
G

Guest

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.
 
?

=?iso-2022-jp?B?GyRCJSohPCVKITwbKEI=?=

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top