Storing calculated values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tulikapuri
    New Member
    • Feb 2007
    • 55

    Storing calculated values

    Hello Folks,

    I am putting together a DB and trying to sum up the total scrap produced in house for the day, i have a report which accomplishes this task for me.

    But after i get the total scrap in the report i want it to be stored in my table aswell, bcoz i will need this information to make the other report which brings together internal and external scrap. I have the total scrap column in the table and the form aswell, and when i try to set the control source property of this field it pops up with NAME?, can you please suggest me where i am missing a link?

    Your help is appreciated in advance.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    What are you setting the control source to?

    Comment

    • tulikapuri
      New Member
      • Feb 2007
      • 55

      #3
      I am setting the control source as =[Reports]![Bedplate]![GrandTotal]

      Comment

      • tulikapuri
        New Member
        • Feb 2007
        • 55

        #4
        Also, my DB has started behaving v funny.

        I am trying to set the control source property for the internal scrap % and external scrap %, it works wonderful but the only problem is it doesnt save properly in the table, for e.g. i get internal scrap % as 4.51 on the form but it saves as 500 % in the table.

        I changed the textbox scrap % control properties for the form as:
        Format = %
        Decimal = Auto

        I changed the field properties for the internal scrap % in the table as:
        field size= double
        format= %
        decimal = auto

        Thanks

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Originally posted by tulikapuri
          I am setting the control source as =[Reports]![Bedplate]![GrandTotal]
          That control source should just be [GrandTotal]

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Originally posted by tulikapuri
            Also, my DB has started behaving v funny.

            I am trying to set the control source property for the internal scrap % and external scrap %, it works wonderful but the only problem is it doesnt save properly in the table, for e.g. i get internal scrap % as 4.51 on the form but it saves as 500 % in the table.

            I changed the textbox scrap % control properties for the form as:
            Format = %
            Decimal = Auto

            I changed the field properties for the internal scrap % in the table as:
            field size= double
            format= %
            decimal = auto

            Thanks
            4.51 is percentage talk is 451 %. I can only assume it's rounding up to 5 which is 500%. 4.51 % is 0.0451

            Comment

            • tulikapuri
              New Member
              • Feb 2007
              • 55

              #7
              How can i save it as 4.51 and not 500 % what do i need to change?

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                Change the format of the field to double.

                Comment

                • tulikapuri
                  New Member
                  • Feb 2007
                  • 55

                  #9
                  I have tried this but it is not working too, i have changed the control source property in the form.

                  I have following fields, Date, Part Number, Good pieces, External Scrap, External Scrap % and Total Production.

                  Now i want external scrap % to be calculated by itself on this form when i enter the values, so i set the formula for external scrap % = ([External Scrap] / ([External Scrap] +[Good Pieces])) in the control source property.

                  The problem is that it calculates the % and its perfect on the form but doesnt store it in the table, i changes the field properties of the table to it saves as 0.00% in the table, can ya tell me wots wrong?

                  Also, when i change the control source property for total production = ([External scrap] + [Good pieces]), it also doesnt save in the table. It displays as 0 in the table.

                  Comment

                  • Rabbit
                    Recognized Expert MVP
                    • Jan 2007
                    • 12517

                    #10
                    The control source tells it where to store the data entered into the control. You have to leave it as the field you want it to store to. You'll have to do the calculation through the after update events of the controls that have a role in the calculation. But here's the kicker, if your table stores all the information needed to perform the calculation, then you don't need to store the calculated value. You just recalculate the value when you need it.

                    Comment

                    • tulikapuri
                      New Member
                      • Feb 2007
                      • 55

                      #11
                      Originally posted by Rabbit
                      The control source tells it where to store the data entered into the control. You have to leave it as the field you want it to store to. You'll have to do the calculation through the after update events of the controls that have a role in the calculation. But here's the kicker, if your table stores all the information needed to perform the calculation, then you don't need to store the calculated value. You just recalculate the value when you need it.
                      Okies i got you.

                      Thanks a lot Rabbit.

                      Ya helped me a lot :)

                      Comment

                      • Rabbit
                        Recognized Expert MVP
                        • Jan 2007
                        • 12517

                        #12
                        Not a problem, good luck.

                        Comment

                        Working...