Results 1 to 4 of 4
  1. #1
    Spoilz is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    2

    How to lookup a record and return 0 if not found.

    Hi,

    I am an access beginner but trying to do something that should be pretty simple.

    I have a query called "customer" and a query called "promo" which contains promo codes. Not every customer has a promo code and some customers have multiple codes.

    I want to create a field in the "customer" query that returns "yes" or "no" if that customer has any promo code.

    I have been searching online all day and tried many different things but getting no closer. The best I can get is a field that returns "#error" if there are no records and "1" if there is a record.

    Note - I am not so good on SQL so any help using access functions would be appreciated.

    thanks,

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are the "promo" codes in the same tables as the customers?

  3. #3
    Spoilz is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    2
    No. Actually both are in their own sub queries but the original data are in two different tables.

    I have no problem moving across tables to get total orders when I am playing with numbers but when I try to do a simple lookup, I'm lost.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Here's a link on how to do the Domain Functions. All of the arguments are STRINGS!
    http://access.mvps.org/access/general/gen0018.htm
    Post back here if it still evades you.

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

Similar Threads

  1. The search key was not found in any record
    By virtualprg in forum Import/Export Data
    Replies: 46
    Last Post: 08-26-2014, 10:51 AM
  2. Replies: 7
    Last Post: 04-30-2012, 03:21 PM
  3. Return all fields even if lookup is empty
    By skarden in forum Access
    Replies: 2
    Last Post: 05-11-2011, 10:44 AM
  4. Need help on transferring found record
    By awsmitty in forum Access
    Replies: 1
    Last Post: 01-22-2010, 09:11 PM
  5. Return 0 if no records found
    By skwilliamson in forum Programming
    Replies: 1
    Last Post: 12-01-2009, 10:54 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