Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to sum a feild on a subform, and pass it to a from field

Status
Not open for further replies.

attrofy

IS-IT--Management
Jan 10, 2002
694
US
I have a subform with a field named Amount. I want the user to enter as many records as needed on the subform and then have it total the amount on the main form in a field called CreditAmount. I need this to update everytime an amount is added or changed in the subform. I don't know how to add unlimited entries in the Amount field of the subform. Any help is appreciated.

Russell
 
To add unlimited records in a subform use datasheet view.

My approach to totalling is not very nice, but showuld work.

Createa query based on the sub form to total the amounts as they change.

Make another sub form based on the query. USe this on your form to total as you go.

On the onchange event otf the query subform update the main form.
 
hmmmmm...I already have 4 subforms on this one form, guess onemore can't hurt.....Not sure how to run a dynamic query - which it sounds like what you are suggesting. Not quite sure I follow everything here.

If I have my orginal subform (sbfARWriteoff) and have the query Sum all the entries in the field "Amount", then create basically a one box form (called sbfAmount) that has a text box to put this info. Then I assume in the OnChange event of the sbfAmount put some event like:

[Amount]=Form!MainFormName![CreditAmount]
Me.Refresh

Two points of confusion; How do I get the query to update automatically, and what is the correct syntax of passing the subform field's value to the mainform????

Thanks for the help
 
I am sure there is a better way to do this. I'll sleep on it and let you know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top