Results 1 to 13 of 13
  1. #1
    bronson_mech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    94

    how to set a default value zero"0" in Queries

    hi fellas,



    i have problem, i created a query for calculating Sum of Quantities its working perfect..... but i want the default value as zero, so far in some cell it is blank "instead of blank cell i want default value zero" pleas help me in this issue................

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    That's a little vague, but try the Nz() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    bronson_mech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    94
    yeah tried with NZ() fn..... its breaking the summary..........

    Before NZ() Fn
    S.NO Sum
    1 3
    2 3
    3 7

    After NZ() Fn

    S.No Sum
    1 2
    1 1
    2 1
    2 1
    2 1
    3 5
    3 2

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Would it be possible to see how you're using it?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    bronson_mech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    94
    yup sure.........

    Received Qty, Bal Qty, Issued Qty & Redurn Qty & Stock All are Calculated Query.......


    Click image for larger version. 

Name:	default value zero 1.jpg 
Views:	14 
Size:	82.9 KB 
ID:	14574

    and for calculating sum in query is as follow............

    Click image for larger version. 

Name:	default value zero 2.jpg 
Views:	14 
Size:	45.1 KB 
ID:	14575

  6. #6
    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,917
    How about showing Paul the SQL for the query?

  7. #7
    bronson_mech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    94
    SQL Query

    SELECT QryReturnedDetails.ProductID, Sum(QryReturnedDetails.ReturnQty) AS SumOfReturnQty

    FROM QryReturnedDetails
    GROUP BY QryReturnedDetails.ProductID;

  8. #8
    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,917
    I don't see the Nz() function being used.

  9. #9
    bronson_mech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    94
    SELECT QryReturnedDetails.ProductID, Sum(QryReturnedDetails.ReturnQty) AS SumOfReturnQty, Nz([ReturnQty],0) AS ReturnQty
    FROM QryReturnedDetails
    GROUP BY QryReturnedDetails.ProductID, Nz([ReturnQty],0);

  10. #10
    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,917
    Back to you Paul. 8^)

  11. #11
    bronson_mech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    94
    thanks A lot rural guy.......... i got it....... so far i had been using that NZ()fn in wrong Query............ NOw i corrected .......hehehehehehe......... thanx.......

  12. #12
    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,917
    Glad you got it sorted and I should not have stomped on Paul's assisting. Sorry Paul!

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No worries Allan. I've got family in town so have only been here intermittently anyway.
    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. Replies: 1
    Last Post: 09-19-2013, 11:42 AM
  2. Replies: 1
    Last Post: 10-26-2012, 12:52 PM
  3. Replies: 6
    Last Post: 08-11-2011, 10:41 AM
  4. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  5. Replies: 8
    Last Post: 11-12-2010, 10:55 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