Re: 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 <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: Q: changing Table in form
    ... "John W. Vinson" wrote: ... because it opens up another window. ... that they pull from a system, create an Excel spreadsheet and email to ...
    (microsoft.public.access.modulesdaovba)
  • Re: Form tutorials?
    ... "John W. Vinson" wrote: ... know if anyone can point me to relevant tutorials. ... A free tutorial written by Crystal (MS Access MVP): ...
    (microsoft.public.access.forms)
  • Re: seeking a field
    ... "John W. Vinson" wrote: ... In design view of... ... headings that match the text content of the field. ...
    (microsoft.public.access.gettingstarted)
  • Re: Hiding dates Query fields
    ... "John W. Vinson" wrote: ... My query selects all the records that I want. ... John W. Vinson [MVP] ...
    (microsoft.public.access.gettingstarted)
  • Re: Auto update query
    ... "John W. Vinson" wrote: ... Sorry, but that is incorrect. ... address you had previously was wrong, and the new spreadsheet corrects that ...
    (microsoft.public.access.queries)