danomaniac
Programmer
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 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