Solved

Show detail on report based on option group of a form

Posted on 2014-07-28
2
318 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 34

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

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

758 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

20 Experts available now in Live!

Get 1:1 Help Now