Open ODBC Connection...

A

AccessARS

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


I have searched the forums for several days with no luck. Any assistance
would be greatly appreciated.
 
D

Douglas J. Steele

I hate to ask the obvious question, but does C:\Documents and
Settings\User1\My Documents\rates.dsn exist? If so, does the user running
the database have access to that file?
 
A

AccessARS

Yes in both cases since it's 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

Douglas J. Steele said:
I hate to ask the obvious question, but does C:\Documents and
Settings\User1\My Documents\rates.dsn exist? If so, does the user running
the database have access to that file?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


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


I have searched the forums for several days with no luck. Any assistance
would be greatly appreciated.
 

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