Solved

Show detail on report based on option group of a form

Posted on 2014-07-28
2
326 Views
Last Modified: 2014-07-28
I have a report which uses a query as its record source.  But prior to the report being opened I have a form.  On the form is an option group with three choices.   One is "Active" which is not true in the query,. another is "Inactive" which is true in the query, and "All" in which case I want all records to be displayed in the report.  The reason I'm using a query is because there is another criteria where the user selects a customer from a combobox on the form.

So if the used selects "Active" (which is choice 1 in the option group), I want only the records which are false in the query to be displayed on the report.

But if the used selects "Inactive" (which is choice 2 in the option group), I want only the records which are true in the query to be displayed on the report.

And if the used selects "All" (which is choice 3 in the option group), I want all of the records to be displayed on the report.

The field in the underlying table is named "Inactive" and is a yes/no field.

I'm thinking I need a case statement in the detail section of the report but I do not know how to code this.

Can someone please help?

--Steve
0
Comment
Question by:SteveL13
2 Comments
 
LVL 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40224890
Here's a query I use to populate a list box of clients.  It refers to an option group with three options.  1 = active, 2 = inactive, and 3 = all.  Notice it does two specific checks and then defaults to true as the third option.

SELECT tblClients.ClientID, [LastName] & ", " & [FirstName] AS FullName, IIf([forms]![frmClients]![fraStatus]=2,IIf([StatusID] = "I",True,False),IIf([forms]![frmClients]![fraStatus]=1,IIf([StatusID]= "A",True,False),True)) AS Status
FROM tblClients
WHERE IIf([forms]![frmClients]![fraStatus]=2,IIf([StatusID]= "I",True,False),IIf([forms]![frmClients]![fraStatus]=1,IIf([StatusID]= "A",True,False),True))=True
ORDER BY [LastName] & ", " & [FirstName];
0
 

Author Comment

by:SteveL13
ID: 40225114
Very helpful.  Thanks.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

772 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