Solved

Filter Report by Combo Box in Access

Posted on 2008-10-03
8
4,584 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

752 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