Results 1 to 4 of 4
  1. #1
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46

    Using more than two IIF in query shows blank

    Hi Experts, Been looking for a solution (or reason why) to this can seem to find one online..

    I have a query with many fields, but focusing on the below 4 fields:
    [EMPLOYEE_ID]
    [FLASHER_NUMBER]
    [SIGNAL_NUMBER]
    [LIGHT_NUMBER]

    I am using the following IIF criterion syntax for each field:
    Like IIf(IsNull([Forms]![frmREPORTS]![Combo Name]),"*",[Forms]![frmREPORTS]![Combo Name])

    The above work great with two field criteria's, but when I use the above syntax with a third (or more) field... the query returns blank.

    My SQL syntax using three fields ;
    SELECT DISTINCTROW tblTIMESHEET.SYNC_DATE, tblTIMESHEET.UNQ_LINK_ID, tblTIMESHEET.LOG_DATE, tblTIMESHEET.LINK_ID, tblSIGNALS.DEVICE_TYPE, tblTIMESHEET.EMPLOYEE_ID, tblSIGNALS.FLASHER_NUMBER, tblSIGNALS.SIGNAL_NUMBER, tblSIGNALS.LIGHT_NUMBER, tblTIMESHEET.PROJ_CHARGE_NUMBER, tblTIMESHEET.MAINT_LOG_PENDING, tblTIMESHEET.PROJECT_DESCRIPTION, tblTIMESHEET.TASK_ID, tblTIMESHEET.TRCD, tblTIMESHEET.PC, tblTIMESHEET.HOURS, tblTIMESHEET.VEH_ID, tblTIMESHEET.VEH_PC, tblTIMESHEET.VEH_TRCD_ID, tblTIMESHEET.VEH_HOURS, tblTIMESHEET.MAINT_INITIATED_DATE, tblTIMESHEET.ML_WORK_DESCRIPTION, tblTIMESHEET.ML_PENDING_COMMENTS, tblTIMESHEET.ML_CLOSE_COMMENTS
    FROM tblTIMESHEET LEFT JOIN tblSIGNALS ON tblTIMESHEET.LINK_ID = tblSIGNALS.LINK_ID
    WHERE (((tblTIMESHEET.EMPLOYEE_ID) Like IIf(IsNull([Forms]![frmREPORTS]![Combo26]),"*",[Forms]![frmREPORTS]![Combo26])) AND ((tblSIGNALS.FLASHER_NUMBER) Like IIf(IsNull([Forms]![frmREPORTS]![Combo32]),"*",[Forms]![frmREPORTS]![Combo32])) AND ((tblSIGNALS.SIGNAL_NUMBER) Like IIf(IsNull([Forms]![frmREPORTS]![Combo28]),"*",[Forms]![frmREPORTS]![Combo28])) AND ((tblTIMESHEET.MAINT_LOG_PENDING)=True))
    ORDER BY tblTIMESHEET.LOG_DATE;


    Can anyone please provide some insight into whats happening or some guidance. I know there are other approaches, but just want to see why this behavior occurs.

    Thanks a bunch in advance !!!



    Regards

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Do they work if you do them one at a time? It may be that only one of them is causing the problem.

  3. #3
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    Yes works alone.. also works great with same criteria in two columns... but when I add the same criteria syntax in a third column(field).. I get nothing.. a blank query result.

    Thanks for the follow-up

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    If you would like to attach a sample database we could take a look.

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

Similar Threads

  1. Replies: 4
    Last Post: 08-30-2014, 10:23 AM
  2. Replies: 1
    Last Post: 05-02-2014, 09:29 AM
  3. Replies: 3
    Last Post: 01-01-2013, 06:22 PM
  4. Replies: 1
    Last Post: 07-15-2011, 10:59 PM
  5. Combo box shows blank on opening the Form
    By Alex Motilal in forum Forms
    Replies: 7
    Last Post: 01-15-2010, 11:59 AM

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
  •  
Other Forums: Microsoft Office Forums