Feb 19 2023 09:45 AM
Why will the following SQL statement not work re: count number of records and group by ProductName:
Set qtQtrResults = _ Workbooks(1).Worksheets(1).QueryTables(1)
With qtQtrResults
.CommandType = xlCmdSQL
.CommandText = "SELECT ProductName, Count(*) FROM Products GROUP BY ProductName"
.Refresh
End With