Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    29

    Unanswered: Subform Vs Mainform Calculations

    I have a subform on the main form with one to many relationship.I just want one of the field on the subform to update the corresponding field on the mainform,as follows:
    Field names; On the main form : Total Amount Paid
    On the subform:Amount Paid
    Every time user enters Amount Paid on the subform,it should add up to the Total Amount Paid on the main form...
    Help please!!!!!!!!!!

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by fadone
    I have a subform on the main form with one to many relationship.I just want one of the field on the subform to update the corresponding field on the mainform,as follows:
    Field names; On the main form : Total Amount Paid
    On the subform:Amount Paid
    Every time user enters Amount Paid on the subform,it should add up to the Total Amount Paid on the main form...
    Help please!!!!!!!!!!
    IF your textbox on the main form is bound to a query calc'ing the amount, you can have the subform textbox ReQuery the main textbox in say the AfterUpdate event ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Nov 2005
    Posts
    29

    subform vs mainform calculations

    Quote Originally Posted by M Owen
    IF your textbox on the main form is bound to a query calc'ing the amount, you can have the subform textbox ReQuery the main textbox in say the AfterUpdate event ...
    Well ,Mr Owen ...the textbox on the main form isnt bound to a query .As I said,the subform subtotal field should update the mainform grand total field,everytime a subtotal field is updated.The formula has to be defined at the forms'field levels.
    I think thats understood!
    Waiting to hear your suggestions........

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by fadone
    Well ,Mr Owen ...the textbox on the main form isnt bound to a query .As I said,the subform subtotal field should update the mainform grand total field,everytime a subtotal field is updated.The formula has to be defined at the forms'field levels.
    I think thats understood!
    Waiting to hear your suggestions........
    And EXACTLY WHERE do you want to have that done fadone????? A more basic question is: Which form here is the CONTROLLING form? My suggestion IS STANDARD PROGRAMMING PRACTICE ...

    Also, lest you get confused: Setting a RowSource assignment for a textbox to DSUM("SomeColumnNameHere","SomeTableNameHere","Som eOptionalConditionHere") IS A QUERY ... You use this to do your dirty work ...

    You COULD also put some code in the AfterUpdate event of your continuous forms textbox to run effectively the SAME QUERY and post the result to the main form textbox ...

    I guess I just gave you the same suggestions as before ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Nov 2005
    Posts
    29
    Quote Originally Posted by M Owen
    And EXACTLY WHERE do you want to have that done fadone?????
    A more basic question is: Which form here is the CONTROLLING form? My suggestion IS STANDARD PROGRAMMING PRACTICE .....
    I want it to be done on the mainform once a subform field is updated!
    hence a subform is controlling the mainform....

  6. #6
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by fadone
    I want it to be done on the mainform once a subform field is updated!
    hence a subform is controlling the mainform....
    Wow, you're telling the Grand Poobah....tsk tsk. Anyway, this is what I have on my MAIN form that references the totals in my Subform.

    Code:
    =[Videos1 subform].Form!Subtotal
    That's about it. Subtotal being the TextBox on the Subform with the calculations in it.

    have fun,
    BUD
    Attached Thumbnails Attached Thumbnails MainRefSub.bmp  
    Last edited by Bud; 12-05-05 at 04:07.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •