odbc won't connect

pandale

New Member
Joined
Aug 4, 2014
Messages
7
can someone tell me whats wrong with this code? i'm running windows 8.1 with latest updates, excel 365, and have MySQL ODBC 3.51 Driver loaded on my computer and all are verified with current version.

when i get to the last line, i get a run time error 3706.

yes i have the correct server, db_name, user and password

Sub connectDB()
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server


If ActiveSheet.Range("$B$24").Value <> "" Then


db_server = ""
db_name = ""
db_username = ""
db_userpassword = ""


connectstr = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=; PORT=3306;" & "DATABASE=; USER=; PASSWORD=; OPTION=3;"


Dim strFirstName As String
Dim strLastName As String
Dim strEmailAddress As String
Dim intIsActive As Integer
Dim intAgreed As Integer
Dim strExpiration As String
With ActiveSheet
strFirstName = ActiveSheet.Range("$B$12")
strLastName = ActiveSheet.Range("$D$12")
strEmail = ActiveSheet.Range("$B$24")
intIsActive = 1
intAgreed = 1
strExpiration = Format(ActiveSheet.Range("$A$100").Value + 365, "yyyy-mm-dd")
End With


Set oRs = CreateObject("ADODB.Recordset")
Set oConn = CreateObject("ADODB.Connection")
oConn.Open connectstr
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top