Solved

Filter Report

Posted on 2011-09-29
9
396 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

776 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