How do i design a form that asks for a begining date and
an end date, not that parameter box that appears with
Between - And quey. Its basically the same Report Date
Range in sample contacts database.
Thanks
Iain
Iain,
Create a new unbound form (the form has no record source).
Add 2 text controls to the form.
Name one 'StartDate'.
Name the other 'EndDate'.
Set their format property to a Date format.
Name this form "ParamForm".
Add a command button.
Code the command button click event as below.
(It's coding will be determined by what you are using the query for.)
1) If it is to simply display data, code the button click event:
DoCmd.OpenQuery "QueryName"
DoCmd.Close acForm, Me.Name
As criteria in the query, use:
Between forms!ParamForm!StartDate AND forms!ParamForm!EndDate
Open the form, enter the dates, then click the command button.
The query will display. The form will close.
2) If the query is to be used as a recordsource for a report, code the
Form's command button:
Me.Visible = False
Code the Query criteria the same as above.
Then code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog
Code the Report's Close event:
DoCmd.Close acForm, "ParamForm"
Run the Report.
The report will then open the form. Enter the dates. Click the command
button. The Report will display the records.
When you close the report, it will close the form.
You will not actually see the query, just the report.
Fred
Please respond only to this newsgroup.
I do not reply to personal email