openrecordset with several date ranges

  • Thread starter Thread starter Luc
  • Start date Start date
L

Luc

I'm trying to open a recordset with the following
criteria:

Set rstin = dbs.OpenRecordset("Select * from tblrecordsin
Where StartDate Between #" & varDateBeg & "# And #" &
varDateEnd & "# Or EndDate Between #" & varDateBeg & "#
And #" & varDateEnd & "#")

When trying to run the routine the program halts at this
line and returns the following error message:

Object Variable or With Block Variable Not Set.

Anyone has any idea why I'm getting this error message?
Thanks...
 
Probaby due to National Date Setting Problems
Try
"SELECT .. FROM ... WHERE StartDate BETWEEN #" &
Format(VarDateBeg,"mm\/dd\/yyyy") & "# ..... "
As the American date format is what Jet Expects ...

HTH
Pieter
 
Back
Top