Results 1 to 7 of 7
  1. #1
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80

    IIf on Query when linked to multiple tables


    I have an Iif in a column on the query:
    Code:
    B1: IIf(([Disposition]=4),"Remove from Pending/")
    The Disposition field on my main table (tblConsultData) pulls it's selectable values from another table (tblConsultDispositions). When I try to do this statement it returns an #ERROR in the field. I can make this work with fields that don't have a Combo Box pulling values from another table, but in the query it loads the values of the Disposition field as a number value to reflect this (4, for example instead of 'Scheduled' which is what the 4 value represents). Any idea how to make this work?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Are you saying that you have lookup fields on the table? This is a very bad idea - as you are finding out. Remove them and use queries for all your lookups.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    The expression should still work. It does for me.

    However, I NEVER set lookups in table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80
    No the field is directly in the table, but when users are using this it limits the selection in that field based on options listed in a second table.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    We understand Disposition is field in table and that field is set with Lookup. I NEVER do this in tables. However, the query expression should still work. I tested.

    Users should not interact directly with tables and queries, only forms and reports. Therefore it is of little value to set lookups in table. As developer, when I view tables, I prefer to see actual value saved in field, not the alias.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Dont use IIF,s. Use a lookup table with all values and their meaings,

    code, descr
    3, other
    4, Disposition

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    @ranman256, Disposition is a field name, not a data value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. import ot multiple linked tables
    By Jen0dorf in forum Access
    Replies: 6
    Last Post: 02-05-2016, 07:14 AM
  2. Multiple linked tables query
    By cchampagne17 in forum Queries
    Replies: 3
    Last Post: 07-31-2012, 07:42 PM
  3. Redirect multiple Linked Tables using VBA
    By Wiggles8831 in forum Access
    Replies: 4
    Last Post: 02-08-2012, 11:38 AM
  4. Replies: 5
    Last Post: 02-02-2012, 06:42 PM
  5. Replies: 1
    Last Post: 08-19-2009, 01:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums