How to assign value of unbound field to a bound field in a form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kathnicole
    New Member
    • Mar 2007
    • 33

    How to assign value of unbound field to a bound field in a form?

    Hi,

    I am using MS Access 2007/Vista

    I have a field, ProductCost in the subform. i need to find the total of ProductCost and assign it to a field, Total, in the Main Form .

    I read an article about how to find Sum from a subform field.
    based on that, i stored the total value in an unbound field.

    i dont know how to assign the value from the unbound field to a bound field , Total, in the main form.


    can anyone help me in this regard,?

    thanks

    Kathy
  • hjozinovic
    New Member
    • Oct 2007
    • 167

    #2
    Originally posted by kathnicole
    Hi,

    I am using MS Access 2007/Vista

    I have a field, ProductCost in the subform. i need to find the total of ProductCost and assign it to a field, Total, in the Main Form .

    I read an article about how to find Sum from a subform field.
    based on that, i stored the total value in an unbound field.

    i dont know how to assign the value from the unbound field to a bound field , Total, in the main form.
    Hi there!
    In subform's footer put an unbount control named SumProductCost. It's source property should be: =Sum(ProductCos t)
    ...If I understood correctly you allready came this far.

    To show this total on the Main form put an unbound control named MainTotal in Main form's detail or footer section (if it's gonna be visible).

    In MainTotal's source property put: =Me!SubFormName .Form.SumProduc tCost

    I'll be here if you have more questions. Also you might try to read help in MSAccess, it's full of advices like this :-)

    h.

    Comment

    • kathnicole
      New Member
      • Mar 2007
      • 33

      #3
      thanks for your reply.

      I can get the value in the main form unbound field.

      but i dunno how to store that value in to a bound field in a table...

      for example,

      i used the suggestion you gave me and i created an unbound field MainTotal
      it works like a charm.

      now, i wanted to assign the value in MainTotal unbound field into a field, TOTAL, in the main table.

      is it possible to acheive this???

      thanks in advance.

      luv,
      Kathy

      Comment

      • hjozinovic
        New Member
        • Oct 2007
        • 167

        #4
        hey Kathy

        Usually calculated values are not supposed to be stored in the tables because they can be allways recalculated. Anyway, if you wanna store that walue in the TOTAL field on your Main Form just add a code like this in your Sub Form's after update event:

        Code:
        Me.Recalc
        Me.Parent.TOTAL = Me.Parent.MainTotal
        After this Main Form will be in editing mode, and changes will not yet be saved so you can discard changes if you want.

        Best,
        h.

        Comment

        Working...