Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter records?

Status
Not open for further replies.

danomaniac

Programmer
Jan 16, 2002
266
US
Hey all! I have a question...

I have a form that displays the records in an Access database. I have a combo box that pulls in a list of all the record numbers in the table and a user can select one, and it will populate the boxes with all the data for that record (search by record #). It works great. I'm trying to create another search box for searching by date. I'd like to have two text boxes where the user can enter a From date and a To date, then click a button and have a filtered recordset to look through.

The search by record # is using the following code and it works:

Filter = "query1.recordnumber = forms!form1![cboRecordNumber]"
FilterOn = True

I'm assuming I need to take a similar approach for the date search and this is what I've tried, but I'm sure I'm missing something (because it doesn't work).

Filter = "Between query1.Open_date = forms!form1![txtfrom]AND query1.Open_date = forms!form1![txtto]"
FilterOn = True


Thanks for any advice
 
I answered my own question. Evidently a syntax problem. This is what I ended up with that works:


Filter = "nonconf.Open_date Between forms!f_nonconformance![txtfrom]AND forms!f_nonconformance![txtto]"
FilterOn = True

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top