View Single Post
  #11  
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]