Searching criteria based on date/time

I am using access database (mdb). I have a Date/Time field in the database. My application allows user to enter start date and end date as searching criteria. How do I construct a sql query to do such search ? I am using ADO.

Who is Participating?

Give something like this a shot:


rs->Open("Select * from MyTable Where <date_field> between #<begin_date># and #<end_date>#", conn.GetInterfacePtr(), adOpenForwardOnly, adLockReadOnly, adCmdText);


rs = Instance of _RecordsetPtr
conn = Instance of _ConnectionPtr

I hope that helps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.