In your query, for the date field you are checking, reference the form fields using:
[Forms]![yourformname]![textfieldcontrolname]
E.g. If you are reporting on a single date from your table (call it "SampleToDate") and your form name is "SampleReportStart" and your from date is "txtFromDate" and your to date is "txtToDate" specify this criteria for the SampleToDate in your "myquery":
Between [Forms]![SampleReportStart]![txtFromDate] and [Forms]![SampleReportStart]![txtToDate]
Be careful of the "Between" or for that matter be careful of using "<=" and ">=". If any of the values in SampleToDate include time, records will not be selected. That happens because "txtToDate" will be interpretted as "mm/dd/yyyy 00:00:00 am".
There are several ways around this:
+ Have your users specify the time (or add the time for the users)
+ Format the date field of the table in your query:
Format([SampleToDate],"mm/dd/yyyy") as CheckDate
+ alter the criteria to:
Between [Forms]![TextOutput]![txtFromDate] and (CDate([Forms]![SampleReportStart]![txtToDate]) + 1)
Note: the last solution will pick up SampleToDate values for one day greater than the user specified if the values in SampleToDate are date only.
Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org