Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting Info in a Report

Status
Not open for further replies.

swicklund

Technical User
Apr 26, 2005
10
0
0
US
I have a a form where I click a button and a report comes up based on a query.

What I would like to happen is, once the button is clicked, the user is prompted to select a category, and then the report is run for that category.

The list of categories is continually growing, so I would rather not have to set up a button/query for each category.

Any ideas??
 
Place a combo box on your form that lists each different category. Then use code to open the report like:

Dim strWhere as String
strWhere = "[Category] = '" & Me.cboCategory & "'"
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
You might want to use a multi-select list box. That way the user can select 1 or more categories to be included in the report (or future reports). This FAQ faq181-5497 contains a function that will build the Where clause for you. It works for single and multi-select list boxes, combo boxes, text boxes, ranges, option groups, and check boxes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top