Results 1 to 7 of 7
  1. #1
    ttrautz is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    8

    Null Value as Zero in DLookup Cell


    Hello,

    I have a cell that looks up a value from a query. When that lookup is null, I would like the cell to show a $0.00 value so that the calculated cell (Contract Value + Change Order Value) can perform its function.

    Currently, the formula I am using is:

    =DLookUp("[SumOfTOTAL]","SUM_ChangeOrders_Query","[Job Number] =" & [Forms]![MAIN_MENU]![txtJobN])

    How would I write it to make it show a $0.00 for a null? Not sure how to use the NZ function in this format.

    Thank you!

  2. #2
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    You can wrap the DLookup in the Nz() function ;

    =Nz(DLookUp("[SumOfTOTAL]","SUM_ChangeOrders_Query","[Job Number] =" & [Forms]![MAIN_MENU]![txtJobN]),0.00)

    Last edited by Minty; 02-20-2018 at 10:00 AM. Reason: Removed dufus paste = = = =
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    ttrautz is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    8
    Thank you!

  4. #4
    ttrautz is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    8
    It is saying that the formula has invalid syntax....thoughts?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Remove the = before DLookup.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Oops - cut and paste fail - sorry
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by Minty View Post
    Oops - cut and paste fail - sorry
    Shameful; I've never done that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Operator and Null errors with Dlookup
    By breezett93 in forum Access
    Replies: 14
    Last Post: 08-15-2017, 01:54 PM
  2. Access dlookup invalid use of null
    By cuddihy1990 in forum Programming
    Replies: 4
    Last Post: 06-25-2014, 03:38 PM
  3. Handling Null DLookup result
    By j6sander in forum Access
    Replies: 1
    Last Post: 07-19-2012, 11:07 AM
  4. Dlookup problem - Invalid use of Null
    By chuki2 in forum Programming
    Replies: 1
    Last Post: 07-18-2012, 10:36 PM
  5. Dlookup() for NULL
    By jgelpi16 in forum Programming
    Replies: 3
    Last Post: 03-31-2011, 12:37 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