adding a calculating field in a sub form

jazmin

New member
Local time
Yesterday, 20:13
Joined
Mar 21, 2008
Messages
5
hi

i want to add a calculating field in my sub form so that it sums up my cost field. can anyone help please

thanks x
 
Put a text box in your subform's footer and use:

=Sum(Nz([YourFieldNameHere],0))

and then use another text box on your main form to display it:

=[YourSubformContainerControl]![Form]![YourTextBoxName]
 
hi thanks for your help but i don't really understand the second part of your answer.
=[YourSubformContainerControl]![Form]![YourTextBoxName]
what is the subform container control? and do i type in the forms name in the [form] part??

thanks and sorry if im being stupid x
 
YourSubformContainerControl is the control on the main form that houses the subform. It can be named the same as the subform, but frequenty isn't, so you need to use the container name, instead of the subform name.

Second the word .Form. stays as is. It tells Access that you want to use a property or method on the subform as opposed to the control housing the subform.

See here on my website for more about that (see the screenshot):
http://www.btabdevelopment.com/main...rhowtoreferencesubforms/tabid/76/Default.aspx
 
thanks again but i kinda deleted the containercontrol because i put the subform in a tab control
 
thanks again but i kinda deleted the containercontrol because i put the subform in a tab control

If you have a subform on the tab control, you still have a subform container. The subform cannot exist on another form without it.
 

Users who are viewing this thread

Back
Top Bottom