FYI
Dim FromDate, ToDate As Date
Only specifies the data type of Date to ToDate. FromDate is Variant.

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" _