Creating reports with User defined criteria

S

Sue

Hello

I would like to create a report where, the user will have to select
from a drop down box one of the field names. For example, if the user
selected Last Name from the drop down box, then, an other form should
open up for the user to type in a search criteria, in this case a last
name, and the report should open up with all the last names that
match. Can someone please tell me as to how this can be done. All
information the report would need is all from the same table.

Any help I could get would be appreciated.

Thanks
Sue..
 
W

Wayne Morgan

In the Open event of the Report, open the form using the acDialog window
mode argument. This will pause the code until you close or hide the form.
Have the controls you desire on the form for the user to make their
selections. Once the selections have been made, you need two buttons on the
form, an Ok and a Cancel. The Ok button will hide the form, the Cancel will
close it. In the report's Open event, check to see if the form is still
open. If it isn't, cancel opening the report. If it is, continue to open the
report. Remember to close form in the report's Close event.

Use the selections on the form as parameters for the query feeding the
report. To do this, refer to the controls on the form in the criteria of the
query.

Example Criteria:
Forms!frmFormForReport!txtMyTextbox
 
Top