Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Old 11-24-2011, 11:20 AM   #1
Turvoll
Newly Registered User
 
Join Date: Nov 2011
Location: Norway
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Turvoll is on a distinguished road
Show either True, False or both True and False in query

Hey
In a materials table I have a Yes/No field called Reserved used to indicate if the material is reserved for a contract or not.
When looking at the inventory list, I have 3 opion buttons called Reserved, NotReserved and ShowAll. The options are given the values -1, 0 and 1 respectivly. The query runs after updating / chosing a value.
I am trying to have the query show all if the value is 1 (ShowAll). Have using the Iif function but have not succeded. The query runs OK as long as the value -1 or 0 is passed on to the query.

Anyone that can help?

Turvoll is offline   Reply With Quote
Old 11-24-2011, 11:39 AM   #2
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Show either True, False or both True and False in query

So let's see the IIF() function that you tried.
vbaInet is offline   Reply With Quote
Old 11-24-2011, 12:10 PM   #3
Turvoll
Newly Registered User
 
Join Date: Nov 2011
Location: Norway
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Turvoll is on a distinguished road
Re: Show either True, False or both True and False in query

OK, here is the Iif statement:

Iif(Forms![MatList]![ReservedStatus]=1;Like "*";Forms![MatList]![ReservedStatus])

Turvoll is offline   Reply With Quote
Old 11-24-2011, 12:17 PM   #4
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Show either True, False or both True and False in query

Code:
LIKE IIf([Forms]![MatList]![ReservedStatus]=1, "*", [Forms]![MatList]![ReservedStatus])
vbaInet is offline   Reply With Quote
The Following User Says Thank You to vbaInet For This Useful Post:
Turvoll (11-24-2011)
Old 11-24-2011, 12:23 PM   #5
Turvoll
Newly Registered User
 
Join Date: Nov 2011
Location: Norway
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Turvoll is on a distinguished road
Re: Show either True, False or both True and False in query

Great. It works! Thanks
Turvoll is offline   Reply With Quote
Old 11-24-2011, 02:14 PM   #6
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Show either True, False or both True and False in query

You're welcome!

vbaInet is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update query-If criteria true,value true else false in same query merc_slk Queries 3 01-11-2010 02:27 PM
Making record not show on form, based on True/False value Jarad Forms 2 07-06-2007 08:53 AM
True or False Query Issue jesusoneez Queries 4 05-12-2006 04:57 AM
show if false but wont let me make it true bunji Forms 2 09-16-2005 04:54 AM
displaying only true/false values that are true shrndegruv Reports 7 11-08-2004 09:55 AM




All times are GMT -8. The time now is 03:08 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World