Calculate subform text boxes in main form

ijit

Registered User.
Local time
Today, 13:18
Joined
Oct 17, 2007
Messages
15
I have a main form called OvenCodes. It has a subform called sfrmOven1. I need a control in the main form that calculates an average of 5 fields in the subform. The text boxes in the subform are these:

GlossA
GlossB
GlossC
GlossD
GlossE

I need something like this:

=Avg(Forms!sfrmOven1.GlossA , Forms!sfrmOven1.GlossB , Forms!sfrmOven1.GlossC , Forms!sfrmOven1.GlossD , Forms!sfrmOven1.GlossE)

I tried this and using the expression builder, but neither worked. Let me kow if there is some kind of resource that I can refer to.
 
Are you wanting the average of the subform's field record values (e.g., the average of 5 fields across each record), or the average of the field averages??? Looks like you have textbox's representing your fields, so there will be only one value in each. So, the two forms are not related one-to-many then, right??
 
I don't know how your subform is organized, but what I would suggest is that your calculation could actually be done on the subform. I think the coding is a bit easier, but it does create an "extra" textbox. You could then reference the subform textbox holding the computed value from the mainform.
Code:
Me.AverageValue=Me.SubFormName.Form.ComputeAverage
 

Users who are viewing this thread

Back
Top Bottom