Hi Guys,
Been some time since I was last here, hope all is well with the forum.
I have a database query macro that I recorded, and want to modify the dates but everytime I put a variable to the date, it errors on me.
The Problem I beleive stems from this line here ts ‘2011-06-13 02:26:48……
Can anyone steer me in the right direction?
Thanks,
Darryl.
Range(“A1”).Select
With ActiveSheet.QueryTables.Add(Connection:= _
“ODBC;DSN=VPC – PROD;Description=VPC – PROD;UID=datalink;PWD=datalink;APP=Microsoft® Query;WSID=VPC-PMXP-PLT1;DATABASE=VPC” _
, Destination:=Range(“A2”))
.CommandText = Array( _
“SELECT plate_flow.job_ref, plate_flow.line_number, plate_flow.scanned_time” & Chr(13) & “” & Chr(10) & “FROM VPC.dbo.plate_flow plate_flow” & Chr(13) & “” & Chr(10) & “WHERE (plate_flow.line_number=’1’) AND (plate_flow.scanned_time>{ts ‘2011-06-13 02:26:48” _
, “‘})”)
.Name = “Query from VPC – PROD”
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With