FYI
Only specifies the data type of Date to ToDate. FromDate is Variant.Dim FromDate, ToDate As Date
Try something like this.
Dim FromDate As String Dim ToDate As String "Date>={ts '" & FromDate & "'} And NonHourlyPrice.PriceDate<={ts '" & ToDate & "'})" & Chr(13) & "" & Chr(10) & "ORDER BY NonHourlyPrice.PriceDate" _