Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Oct 2001
    Location
    New York
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If statement (Access 2000)

    I am having trouble with an IIF statement. I have a database of clients (tblClients). Some of our clients may have several contacts (tblContacts). When I run a query using both tables, the query won't pull in the address for the contact, but will put in the client address. How would the IIF statement be written, if ContactAddress1 from tblContact is null, use the ClientAddress1 from the tblClient.

    Thanks
    Nadia

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: If statement (Access 2000)

    No need for an IIf. Try this:

    <code>Nz([tblContact].[ContactAddress1], [tblClient].[ClientAddress1], tblContact].[ContactAddress1])</code>
    Charlotte

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: If statement (Access 2000)

    I'm not sure I understand the situation, but try the Nz function:

    <code>Address: Nz([tblContact].[ContactAddress1],[tblClient].[ClientAddress1])</code>

  4. #4
    Lounger
    Join Date
    Oct 2001
    Location
    New York
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If statement (Access 2000)

    Thanks to both you and Charlotte, it worked great.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •