Solved

Filter Report by Combo Box in Access

Posted on 2008-10-03
8
4,570 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Combobox issue 4 25
Aceess 2016 - Variable Data Fields? 12 41
Access 2016 Merge Tables 8 26
Resize text 4 15
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now