Create DSN with VBA Code MySQL

P

Prüwasser Peter

Hello,

I want to create a DSN in Microsoft Access for MySQL.

I try it with the following Code, but it doesn't work i am always
getting the error 3146

Attr = "Description=" & Me.strDatabase & "" & Chr$(13)
Attr = Attr & "Server=" & Me.strServer & "" & Chr$(13)
Attr = Attr & "user=" & "root" & "" & Chr$(13)
Attr = Attr & "password=" & "PWD" & "" & Chr$(13)
Attr = Attr & "Port=" & "3306" & "" & Chr$(13)
Attr = Attr & "Database=" & Me.strDatabase & ""

DBEngine.RegisterDatabase "mysqlcs1", "MySQL Connector/ODBC v5", True,
Attr

Can anyone please help me??


Thanks Peter
 
T

Tony Toews

Prüwasser Peter said:
I want to create a DSN in Microsoft Access for MySQL.

I try it with the following Code, but it doesn't work i am always
getting the error 3146

What's the text of the error message?

Alternatively ...I much prefer DSN-Less connections as it is one less
thing for someone to have to configure and one less thing for the
users to screw up. This is also better for Citrix/TS farms where
each individual system would have to have a DSN created and
maintained.

Using DSN-Less Connections
http://www.accessmvp.com/djsteele/DSNLessLinks.html
ODBC DSN-Less Connection Tutorial Part I
http://www.amazecreations.com/datafast/GetFile.aspx?file=ODBCTutor01.htm&Article=true
HOWTO: Use "DSN-Less" ODBC Connections with RDO and DAO
http://support.microsoft.com/?id=147875
ODBC DSN Less
http://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
P

Prüwasser Peter

Hello Tony,

The Text of the error message is: odbc call missed

I cannot use DSN Less Connections because our Program is based on DSN
Connections.
And this referrs about 28 modules!

Thanks Peter
 
T

Tony Toews

Prüwasser Peter said:
The Text of the error message is: odbc call missed

Sorry but I have no idea.

You could try searching at groups.google.com, clicking on the Advanced
Search link and limiting your search to the comp.databases.ms-access
newsgroup and the microsoft.public.access.* newsgroups.

You may also want to ask in a MySQL newsgroup.

Do you have a URL handy for the MySQL syntax?

Should you be prefacing DBEngine with DAO or ADO?
I cannot use DSN Less Connections because our Program is based on DSN
Connections.
And this referrs about 28 modules!

Then do a find and replace and fix the code. <smile> Yeah, I know
it's easy for me to say that.

Seriously though have yup experimented with that at all?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

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