Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Filter Report by Combo Box in Access

Posted on 2008-10-03
8
Medium Priority
?
4,601 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

719 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