The following query works in Acess Vba.
Query2 = "SELECT Futures.Date, Futures.PX_OPEN, Futures.PX_HIGH, Futures.PX_LOW, Futures.PX_SETTLE FROM Futures WHERE (((Futures.Date) Between #12/31/2013# And #2/28/2014#));"
But If I get the value of date from excel it gives an error. I have tried putting it like that:
Dim D1 As Date
Dim D2 As Date
D1 = y.Range("A1").Value
D2 = y.Range("A2").Value
Query2 = "SELECT Futures.Date, Futures.PX_OPEN, Futures.PX_HIGH, Futures.PX_LOW, Futures.PX_SETTLE FROM Futures WHERE (((Futures.Date) Between #D1# And #D2#));"
This code gives me an error. I also tried using date number; still get the same error. Any suggestion?
Thanks