Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 21st, 2005, 12:14 PM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Filtering records using iif statement

Hi everyone,

I have created a simple query based on one table in the QBD grid.

The query returns records for the following fields: [DepartmentCode], [DepartmentName],[ActivityCode], [Activity Name], and [Cost].

I have specified the following criteria, on the [ActivityCode] field - "like 61* or like 64* or like 66* or like 68* or like 69* or like 8*", to limit the records returned.

Here is what I am having trouble accomplishing:

When [ActivityCode] is like 8*, I want all values for [DepartmentCode] returned, but when [ActivityCode] is anything else, I want to eliminate those [DeptUnit] records that are like 19*, 9*, and 8*.

Please let me know if you need additional info.

Thanks in advance for your help.

Anlon
 
Old April 21st, 2005, 01:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Welcome to P2P, Anlon.

On your criteria grid in the query, the first row should be like 8* in the [ActivityCode]. On the second row, you should have

Not like 8* (in [ActivityCode])
Like 19* or Like 9* or Like 8* (in [DeptUnit])


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 21st, 2005, 01:24 PM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for your help. Works perfectly.

Anlon





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I make this a IIF Statement Corey Access VBA 1 November 3rd, 2006 08:40 AM
Iif statement in Access rangeview Access 7 March 28th, 2006 01:14 PM
IIF Statement golden Access 2 August 3rd, 2004 01:32 AM
IIF Statement golden Access 3 July 12th, 2004 07:49 PM
IIF Statement Question fastcorvette Access 8 October 31st, 2003 11:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.