Solved

Filter Report

Posted on 2011-09-29
9
395 Views
Last Modified: 2012-05-12
I am looking to copy a report i had created and apply filters to each new report. I have 2 fields "Division" and "Organization". I would like to create the reports as follows by applying the filter
Division 1 Organization 1
Division 1 Organization 2
Division 2 Organization 1

I have completed alot of work on the final report and would like to keep away from redoing queries and creating new reports.
Looking for instructions on setting the filter on a report and the expression that will yiled the results above.
0
Comment
Question by:SMP319
  • 4
  • 4
9 Comments
 
LVL 42

Expert Comment

by:dqmq
ID: 36815552
In an absolute sense, it looks like this:
docmd.openreport "YOURREPORTNAME",,,"Division = 1 and Organization = 1"


However, if you are selecting division and Organization from dropdowns on a form before running the report then you can do it like this:

docmd.openreport "YOURREPORTNAME",,,"Division = " &  me.comboDivision  & " and Organization = " & me.comboOrganization

0
 
LVL 1

Author Comment

by:SMP319
ID: 36815830
cant seem to get it to work, can you provide details on how and where to apply the code to the report for your first option
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36816100

<cant seem to get it to work>
Then can you post What you tried?

Actually it looks like you need "Or" not "And":

Something like this:
"(Division= 1 Or Division=2) Or (Organization =1 Or Organization =2)"


JeffCoachman
0
 
LVL 42

Expert Comment

by:dqmq
ID: 36816188
I was thinking you wanted to open the report programmatically, like from a macro or from a form (as opposed to opening it from the database navigation window.  How do you intend to open the report?
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 1

Author Comment

by:SMP319
ID: 36816367
i planned to open from the navigation  window
0
 
LVL 1

Author Comment

by:SMP319
ID: 36816957
Here is a screen shot. I am new to access. i was trying to add the filter to the report to just show a certain division and Organization in the report.
Screen-shot.xlsx
0
 
LVL 42

Accepted Solution

by:
dqmq earned 500 total points
ID: 36817168
OK, I see your confustion now.  Picture = 1000 words :>)

In your example, copy/Paste this into the report's FILTER Property:

      "Division = ""Research"" and Organization = ""IT"""

But, with that approach you need a different report for each filter.  So, then, if you modify the report, you need to make the same changes in all the similar reports.

Another approach uses only one report, but applies the different filters when you run it.  That's the direction I was steering you.  To keep it simple now, let's run the report from a macro.  (Later, you may want to run the report under the control of a form, which is even more powerful).  But for now...

create a macro,  naming it something like "MyReportFor_IT-Research"
   Action:  OpenReport
   ReportName:  MyReportFor_IT-Research
   Filter Name:  blank
   Where Condition:  [Division] = "Reserach" and [Organization] = "IT"
 
Note, in this case the "filter is going in the Where condition.  Filter name is for a stored filter, which would also work, but is a little more effort.  Also, you will want to blank out the filter property from the report properties.

Now, run the macro from the DB nav window instead of running the report.  

Run

















0
 
LVL 1

Author Closing Comment

by:SMP319
ID: 36817592
So instead of crfeating multiple reports i will create multiple macros to show my results. I am interested in understanding how to do this using the form as you had mentioned. I will post another question. Thanks for you help
0
 
LVL 42

Expert Comment

by:dqmq
ID: 36818977
Yes. Multiple macros instead of multiple reports.

0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

920 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