openrecordset with several date ranges

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...
 
P

Pieter Wijnen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top