I am using a connection to a CSV file to get the information in a XLS macro file and I am having the issue with this query:
DataQuery = "SELECT [LastName], [FirstName], [BadgeNum], IIF(IsNull([CaseDocs]), 0, [CaseDocs]),IIF(IsNull([CallCount]), 0, [CallCount]), IIF(IsNull([DocRate]), 0, [DocRate])" & _
"FROM [" & DataFileName & ".csv] WHERE CallCenterDescription='ECA' AND [LastName] LIKE '" & Sheets(1).Range("G1").Value & "%' AND DATEDIFF(dd,CONVERT(date, CONVERT(varchar(8), [Date]), 112),getdate()) <= " & Sheets(1).Range("G2").Value & ""
the problem is AND DATEDIFF(dd,CONVERT(date, CONVERT(varchar(8), [Date]), 112),getdate()) <= " & Sheets(1).Range("G2").Value & ""
in the where clause:Undefined CONVERT function