localsearchguy
New Member
- Joined
- Feb 26, 2010
- Messages
- 2
I've got a good start, but i'm not that fluent in VBA, so I could really use a hand. I'm trying to pass variables from VBA to a query that is running against a MySQL database. here is the code so far...
I'm questionabout about line 4 and almost positive line 9 is wrong...
Code:
Sub QueryData_Update()
Dim Client As Variant
Set Sheets("ReportUS") = report
Set Sheets("QueryData").ListObject("Table_llmperf9") = QueryData
Set Sheets("ActionsData") = ActionsData
Set Sheets("DirectionData") = DirectionData
Set Sheets("ImpressionData") = ImpressionData
Client = report.Range("C3").Text
With QueryData(Connection:=("ODBC;DSN=perfllm;UID=root;PWD=password;DATABASE=database;OPTION=0;PORT=3306;SERVER=localhost"), Destination:=Sheets("QueryData"))
.CommandText = Array("SELECT * FROM `querydata_view` Where Business Name =" & Client)
.Name = "QueryData_View"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = 2
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub
I'm questionabout about line 4 and almost positive line 9 is wrong...