Results 1 to 2 of 2
  1. #1
    JosmithTwo is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    19

    IIF problem in query criteria

    This IIF works when the form has nothing in the txtVendor field BUT if a vendor is entered, I get nothing. I'm GUESSING that Access is interpreting the IIF with double quotes (i.e. "Like V12345") which it will never find. Suggestions?



    Code:
    SELECT IC_ITEM_REC.ITEM_NO, IC_ITEM_REC.ITEM_PRIME_VEND
    FROM IC_ITEM_REC
    WHERE (((IC_ITEM_REC.ITEM_PRIME_VEND) Like IIf([Forms]![frm_grossProfit]![txtVendor]>"  ",[Forms]![frm_grossProfit]![txtVendor],"*")));

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Why use the IIf?

    Without IIf - if vendor entered, all records matching will return, if no vendor entered then ALL records are retrieved.

    WHERE IC_ITEM_REC.ITEM_PRIME_VEND Like [Forms]![frm_grossProfit]![txtVendor] & "*"
    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. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  2. Problem with a wildcard in a query criteria
    By desk4tbc in forum Programming
    Replies: 1
    Last Post: 08-10-2011, 06:02 PM
  3. Query Criteria problem
    By wpdesigner in forum Queries
    Replies: 0
    Last Post: 07-07-2010, 09:10 AM
  4. Replies: 1
    Last Post: 05-05-2010, 01:54 AM
  5. Replies: 3
    Last Post: 06-03-2009, 07:15 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