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
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Watch MrExcel Video

Forum statistics

Threads
1,109,353
Messages
5,528,197
Members
409,807
Latest member
nicky736

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top