How to use dsum function in unbound form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aaitaman Tamang
    New Member
    • Jul 2011
    • 22

    How to use dsum function in unbound form?

    I have form called "FocusEntry " with unbound field

    There are three field named with three different field name

    1-Safe
    2-AtRisk
    3-TotalObserved
    4-Safe

    In "observed" Control Source i have wrote code as following =(Val(Nz([Safe]))+Val(Nz([AtRisk]))) to get total sum

    In "Safe" Control Source i have wrote =
    Code:
    (Val(Nz([Safe]))/Val(Nz([Obser])))
    to get total percent (Format is percent)

    and at the bottom of form i have added this code to get overall percent and here is the code =
    Code:
    (Val(Nz([Total]))+Val(Nz([Total1]))+Val(Nz([Total2]))+Val(Nz([Total3]))+Val(Nz([Total4]))+Val(Nz([Total5]))+Val(Nz([Total6]))+Val(Nz([Total7]))+Val(Nz([Total8]))+Val(Nz([Total9]))+Val(Nz([Total10]))+Val(Nz([Total11]))+Val(Nz([Total12]))+Val(Nz([Total13]))+Val(Nz([Total14]))+Val(Nz([Total15]))+Val(Nz([Total16])))/17
    My question is how can have the 0% value when form open? Right now whenever i open the form i have default like this "#num!

    also same Default i have having at the bottom as i have overall total sum

    I need help:

    How can i have Default as 0% percent when form open. I want bottom form to sum as i start updating the form and show me the total percent

    Prompt reply much appreciated. If any more explaination i will

    Please help
    Last edited by Niheel; Jul 21 '11, 03:19 PM.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    For Nz() to work, you need a second parameter. The second parameter tells it what to return in the case that the first parameter is a null.

    Comment

    • Aaitaman Tamang
      New Member
      • Jul 2011
      • 22

      #3
      Rabbit, i Just fixed my problems but i still prefer to see your codes. Can i have the example?

      Thanks

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Basically, you would need to do this so it would return a 0 if safe is null.
        Code:
        Nz([Safe], 0)

        Comment

        • Aaitaman Tamang
          New Member
          • Jul 2011
          • 22

          #5
          Rabbit,

          Is there any VBA codes for sum or dsum function. As i fixed the problems yesterday occurred another.

          I want VBA to sum two value in one unbound textbox.

          example:

          Text Text Text Text
          Safe + AtRisk = Observed Total%
          Safe1+ AtRisk = Observed Total%


          Any help?

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            There's no need to use VBA to accomplish what you need. Just type the formula into the control source.

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32633

              #7
              An additional question was added here but had to be moved (Show Value with No Decimal Places) as we only allow a single question per thread.

              Comment

              Working...