Results 1 to 6 of 6
  1. #1
    Lifendason is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    5

    IIf command not working

    Hey all, I am new to this forum and would like some help.



    I have a report that has a text box which I'm trying to get to populate with information in the query, but the table it builds from is controlled by a smaller table via a combo box.

    The combo box table is laid out as below with two columns:

    ServiceID SERVICES
    1 Cooking

    2 Cleaning

    3 Dusting

    ...and etc



    How can I get the report to reference the SERVICES column instead of the ServiceID column?


    I have tried:

    =IIf([ServiceID]="1",1,0)

    and also

    =IIf([ServiceID]="Cooking",1,0)

    and no luck.


    Any help would be appreciated and BTW, I am only a novice.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Is your Report based on the table, or a query?

    If you create a query linking the Combo Box Table to your Main Table, you can return the SERVICES field in your query, and hence, in your Report.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well, this wouldn't have quotes:

    =IIf([ServiceID]=1,1,0)

    If you want to look at the text try:

    =IIf([ServiceID].Column(1)="Cooking",1,0)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Lifendason is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    5
    Thanks for the replies.

    The report references a query based on multiple tables.

    @ pbaldy; I tried your way and get the undefined function in expression error.

  5. #5
    Lifendason is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    5
    Okay I got it!

    It was what pbaldy stated before: =IIf([ServiceID]=1,1,0)

    I kept on putting the "" in there and it would not work, I guess "" is for text.

    Thanks pbadly and everyone that replied!!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Command Buttons Stopped Working on Form
    By genest11 in forum Reports
    Replies: 12
    Last Post: 02-06-2013, 06:59 AM
  2. Replies: 3
    Last Post: 01-29-2013, 04:34 AM
  3. acViewPreview command suddenly not working
    By kelann in forum Reports
    Replies: 2
    Last Post: 10-16-2012, 07:38 AM
  4. Replies: 4
    Last Post: 10-08-2012, 05:33 PM
  5. Filter command not working for subform
    By yes sir in forum Access
    Replies: 15
    Last Post: 10-15-2010, 10:06 PM

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