In the form header create four text boxes and a command button. The four textboxes will be used to enter dates so format appropriately.
Call the first textbox "DateStart1" and the second "DateStart2"
The third will be, "DateEnd1" and the fourth, "DateEnd2"
Call the command button, "Datecmd"
Assume the form is called, "FFFFF", the query, "QQQQQ" and the table, "TTTTT".
Create "QQQQQ" from "TTTTT" and link in the columns you want to look at, QDate1, QDate2, and QLocation.
Under QDate1, paste this under criteria:
Code:
Between IIf(IsNull([Forms]![FFFFF]![DateStart1]),#1/1/0001#,[Forms]![FFFFF]![DateStart1]) And IIf(IsNull([Forms]![FFFFF]![DateStart2]),Date(),[Forms]![FFFFF]![DateStart2])
Under QDate2, paste this under criteria:
Code:
Between IIf(IsNull([Forms]![TFFFFF![DateEnd1]),#1/1/0001#,[Forms]![FFFFF![DateEnd1]) And IIf(IsNull([Forms]![TFFFFF![DateEnd2]),Date(),[Forms]![TFFFFF![DateEnd2])
These two codes will allow you to leave any of the fields blank to filter results even further based on your needs. Play around with them and you will surely understand their logic quickly.
Now back to the Form, FFFFF. go to the properties for the button we called, "Datecmd" and create a macro for the simply opening the query, QQQQQ.
You can also create a button to reset all four fields quickly by just writing code to set all the values for each box to an empty string, for example; DateStart1="".