I've been reading many posts by Banana concerning remote back ends and connection strings and something that's been throwing me off is when I try to create a recordset based off my remote mysql server.
I snatched my connection string from Carl Prothman's awesome site. The code is as follows:
When I run that I get the DSN administrator asking me to choose a DSN - Just like if I had gone through Access -> External Data -> ODBC. I can select my DSN and it will work.
When I set the DSN name in the code like such:
It throws an error that "C:\My Documents\DSNNAME" DSN doesn't exist.
What I would like to do is somehow circumvent the DSN Administrator in code so user's won't have to figure out how to worry about learning the few extra steps.
I snatched my connection string from Carl Prothman's awesome site. The code is as follows:
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlstr As String
Dim MyConnectionString As String
MyConnectionString = "Driver={mySQL};" & _
"Server=www.SERVER.org;" & _
"Port=3306;" & _
"Option=131072;" & _
"Stmt=;" & _
"Database=DATABASENAME;" & _
"Uid=USERID;" & _
"Pwd=PASSWORD"
Set db = OpenDatabase("", , , MyConnectionString)
When I set the DSN name in the code like such:
Code:
Set db = OpenDatabase("DSNNAME", , , MyConnectionString)
What I would like to do is somehow circumvent the DSN Administrator in code so user's won't have to figure out how to worry about learning the few extra steps.