Re: Writing and IIf statement in Access?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Fri, 8 Aug 2008 07:30:01 -0700, Roland <Roland@xxxxxxxxxxxxxxxxxxxxxxxxx>
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]
.



Relevant Pages

  • RE: Writing and IIf statement in Access?
    ... but I am having a similar problem with a report ... that is using several IIf statements within textboxes and I am now trying to ... I have tried to add a second household using the above suggestion ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Multiple IIf Statements Not Working
    ... AccessIM wrote: ... Here are two IIf statements I have tried but don't work: ... IIfAnd ReserveAisle IN, ... MVP ...
    (microsoft.public.access.queries)
  • Two IIF statements in a text box?
    ... Is it possible to have two IIf statements in an expression? ... I have 3 textboxes on my form: [BeginCertNolbl], [EndCertNolbl] and ...
    (microsoft.public.access.forms)