A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Writing and IIf statement in Access?



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old August 12th, 2008, 11:19 AM posted to microsoft.public.access.tablesdbdesign
Roland
external usenet poster
 
Posts: 74
Default Writing and IIf statement in Access?

Thanks John, both work like a dream

"John W. Vinson" wrote:

On Fri, 8 Aug 2008 07:30:01 -0700, Roland
wrote:

Sorry to necro this tread, but I am having a similar problem with a report
that is using several IIf statements within textboxes and I am now trying to
add a second possiblity. (there are a total of 14 Households, but only 2
require their departments to be seperated)

This is what I had orginally for just 1 household
=IIf([HouseholdNumber]=1,"Department: " & [Department],"")

I have tried to add a second household using the above suggestion
=IIf([HouseholdNumber]=1,"Department: " & [Department],""),
IIf([HouseholdNumber]=7,"Department: " & [Department],"")
but this fails. I have also tried And and Or before the 2nd IIf


The first argument can be a logical expression. Try

=IIf([HouseholdNumber]=1 OR [HouseholdNumber] = 7,"Department: " &
[Department],"")

You can also use the IN() syntax:

=IIf([HouseholdNumber] IN (1,7),"Department: " & [Department],"")
--

John W. Vinson [MVP]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.