Results 1 to 3 of 3
  1. #1
    kagoodwin13 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    181

    Query Return Yes or No

    If I have a query that returns a result, can I layer another query on top that will return "Yes" or "No" based on if the result is null or not? I haven't been able to figure out the logic statement yet.

    My query cross-references an ID number against 4 tables that all collect a piece of information about the ID number. The ID number is a part number, and the tables are document numbers with the file path for the document concerning the part number, so I want a query to return whether documents 1-4 have been submitted per part number. Right now I have the query returning the file path, which is good. I am wondering if I can layer another query over top that says If Not Null, return "Yes", Else return "No."

    Right now query returns:
    Code:
    Part Number Document 1 Document 2 Document 3 Document 4
    1A C:\1A-D1.xlsx C:\1A-D4.xlsx
    2B C:\2B-D2.pdf
    3C C:\3C-D3.txt C:\3C-D4.xlsx
    I would like it to return instead:


    Code:
    Part Number Document 1 Document 2 Document 3 Document 4
    1A Yes No No Yes
    2B No Yes No No
    3C No No Yes Yes
    Thanks for any help you can provide. Let me know if you need more clarification.

  2. #2
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    You could use the NZ function to translate NULL to another value. Something like NZ( ReturnFileName > "", False).

    If the ReturnFileName is NULL, then comparing it to the empty string returns NULL, and NZ changes that NULL to False. If ReturnFileName is not NULL, then it's greater than the empty string, so you get True.

  3. #3
    kagoodwin13 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    181
    Thanks for the tip.

    Document 1: IIf(Nz([Doc1]>"")=-1,"Yes","No") is the solution.

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

Similar Threads

  1. Replies: 5
    Last Post: 05-01-2013, 11:39 AM
  2. Quick Return Query
    By worldwidewall in forum Access
    Replies: 2
    Last Post: 03-07-2012, 07:04 PM
  3. return max/min value in single query
    By garamon in forum Access
    Replies: 2
    Last Post: 10-23-2011, 03:50 PM
  4. Return all records from Query
    By ysrini in forum Queries
    Replies: 1
    Last Post: 01-15-2010, 09:52 PM
  5. Return Record # In Query
    By redwinger354 in forum Access
    Replies: 1
    Last Post: 09-15-2007, 01:08 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