Results 1 to 5 of 5
  1. #1
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170

    Join Types and inputting zeroes

    Hi Folks,

    Using the relationship manager I have created several join types that include all of the values from Query1, Field A, and ONLY those records from Query2, Field B, where the joined fields are equal.

    When I run the query, everything works great, and the fields populate where there is a match.

    However, when there is no match instead of inputting a "0" or something else, the cell in Field B just remains blank. Which creates problems when I'm trying to create the calculated field in a new textbox:

    =IIf([SumofA]="","100%",1-([B]/[A]))


    Because Field B is empty it doens't pick up and in my new calculated field there is just a blank space. Can someone help with this?

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Use the NZ function to replace B with an appropriate value.
    Code:
    =IIf([SumofA]="","100%",1-(NZ([B],0)/[A]))

  3. #3
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170
    Thank you.

  4. #4
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170
    Can you refer me to a beginner's guide to the NZ function? Keeps on popping up..

  5. #5
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    This will automatically replace any Null values with a zero or empty string, whichever seems appropriate to the Jet database engine.
    Code:
    NZ(MyTable.MyField)
    This will automatically replace any Null values with an expllicit default value of "XYZ".
    Code:
    NZ(MyTable.MyField,"XYZ")
    For a text field, this can achieve the same thing
    Code:
    MyTable.MyField & ""
    Here's a couple references I found by googling "MS Access 2010 NZ function".
    http://office.microsoft.com/en-us/ac...001228890.aspx
    http://msdn.microsoft.com/en-us/libr.../ff195223.aspx

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

Similar Threads

  1. inputting a calculated value into a table
    By mike_980 in forum Access
    Replies: 1
    Last Post: 10-27-2013, 05:03 PM
  2. Replies: 3
    Last Post: 05-01-2013, 09:52 AM
  3. Replies: 7
    Last Post: 10-25-2011, 08:32 PM
  4. Replies: 2
    Last Post: 07-12-2010, 05:39 AM
  5. Leading Zeroes
    By FREEEEEEDOM in forum Access
    Replies: 2
    Last Post: 04-06-2009, 10:23 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