Results 1 to 5 of 5
  1. #1
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231

    DSUM Encounters Null Values

    When clients update the square footage of their buildings, I want to maintain a running total display. But there are some buildings that they don't have, so the square footage is null.



    So when I try to sum all building types with the line below, I get an error "Invalid use of null"

    building_sq_ft = DSum("[ArenaSqFt] + [ShedSqFt] + [MaintSqFt]", "ALL_BUILDINGS", "MEMBER_ID=" & [current_id])

    How does one deal with a null value when it's encountered in the dsum function? So, if the above line for MaintSqFt, it's value is null.

    Any help would be appreciated....CementCarver

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Nulls are usually handled with the Nz() Function to assign an appropriate value when a Field is Null:

    Nz([ArenaSqFt],0)

    If [ArenaSqFt] is Null, it gets assigned 0 value.

    You could replace the 0 with any DataType appropriate Value.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    Thanks for the super quick reply. I'll give it a try and will close the call if successful.

    Thx...CementCarver

  4. #4
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    Not sure of the syntax....

    building_sq_ft = DSum("Nz([ArenaSqFt],0) + Nz([ShedSqFt],0) + Nz([MaintSqFt],0)", "ALL_BUILDINGS", "MEMBER_ID=" & [current_id])

    Is this the correct syntax?

  5. #5
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    No luck still even with below:

    building_sq_ft = Nz(DSum("[ArenaSqFt] + [ShedSqFt] + [MaintSqFt]", "FULL_COMM_BREAKDOWN", "MEMBER_ID=" & [current_id]), 0)

    this is yielding a building_sq_ft of zero...!!!

    Is this line syntax correct?

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

Similar Threads

  1. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM
  2. Count() and Null Values
    By jpvonhemel in forum Queries
    Replies: 4
    Last Post: 10-21-2011, 03:37 AM
  3. null values
    By ippy in forum Queries
    Replies: 3
    Last Post: 12-20-2010, 10:39 AM
  4. No return on Null values
    By forrestapi in forum Queries
    Replies: 4
    Last Post: 10-18-2010, 08:09 AM
  5. Null Values in query
    By LesleaOH in forum Queries
    Replies: 0
    Last Post: 10-19-2009, 04:45 PM

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