Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2011
    Posts
    8

    Question Unanswered: IIF, Switch, Choose????

    Hi,
    I am running an Access query from two tables. Depending on what one field [ID] result is in the first table, I would like to return a specific field from table 2. There are 3 separate fields in table 2 for the 3 different [ID] results in table 1.

    I have tried the following expression in my query but always get #error in the field when I run the query

    Expr1: Switch([Table1]![ID]=1,[Table2]![Field2], [Table1]![ID]=2,[Table2]![Field3], [Table1]![ID]=3,[Table2]![Field4])

    (ps. the relationship between the two tables is working)

    Thanks in advance,
    Gav

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    It works with:
    Code:
     Choose(Table1.id,table2.field1,table2.field2,table2.field3) as Expr1
    Have a nice day!

  3. #3
    Join Date
    Jun 2011
    Posts
    8

    :)

    Perfect. Thanks!!!!!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Tags for this Thread

Posting Permissions

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