Solved

Filter Report by Combo Box in Access

Posted on 2008-10-03
8
4,577 Views
Last Modified: 2013-11-28
i have a report that i would like to sort by selecting a value from a combobox

the combo box needs to be bound to unique records from a table (there are only 5 differet choices)

the report format stays the same just the data is dependent on what the value of the combobox is.
0
Comment
Question by:bignadad
  • 5
  • 3
8 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 22633245
You can set criteria for your report in the openreport statement, using your combo box:

Docmd.openreport YourreportName,acviewpreview,,"ID = " & me.cboYourCombo

0
 
LVL 61

Expert Comment

by:mbizup
ID: 22633265
Alternatively, you can set criteria in the recordsource query of your report using a WHERE clause:

SELECT * from YourTable WHERE ID = Forms!YourFormName!YourComboName
0
 
LVL 2

Author Comment

by:bignadad
ID: 22633415
recordsource query of your report
where is this??
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 2

Author Comment

by:bignadad
ID: 22633471
okay i found that, but i would like the combo box to be on the report. so when you are looking at the report the combo box can be changed and the new info be printed
0
 
LVL 61

Expert Comment

by:mbizup
ID: 22633644
I don't have a copy of Access 2007 at the moment, and this sort of thing is not possible in earlier versions.

If Access 2007 Allows this type of functionality I imagine it would be similar to controling a form's filter property through a combo box. If that is the case, you would need code like this in the AfterUpdate event of your combo box:

Me.Filter = "ID = " & me.cboMyCombo
me.filteron = TRUE
0
 
LVL 2

Author Comment

by:bignadad
ID: 22634023
where do i put my combo box on the report?
header?
detail?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 22634536
Try the header.

Again, I've got my doubts about this. I know A2K7 gives reports some more functionality - but I don't have a copy at the moment to try this out myself.

In A2k3, you would place the combo box on a form and open a filtered report through that form.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 22634710
I just fired up a copy of A2K7.  While you do have some added form-like functionality, as far as I can tell this will not work in a report.  You need to use an event in a form to accomplish this.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question