Solved

Filter Report

Posted on 2011-09-29
9
399 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
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 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
 
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

Industry Leaders: 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!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
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 Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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