Subform value to Main Form How To?

  • Thread starter Thread starter Blog
  • Start date Start date
B

Blog

Hi All

I'm about ready to buy a rubber mallet to strike my head with over
this...so anyone who can help me will receive much gratitude and positive
energy.

I have a form with some franchisee details, and as a subform; a list all
their incurred fees.
From the main form (as a form on_current event) I want to add up the fees
listed in the subform - and store that value in a field in the main form.

For the life of me I can't seem to reference the field of the subform in
vb. I've tried variations of Forms!ClientList!Fee,
[Forms]![ClientList]![Fee], Forms.("ClientList").("Fee") ...etc.

**Note - I'm using the office XP version of access, and I didn't create
a new form to add as a sub I just hit the subform control button and told
the control what table to use.

Thanks in advance for any help with this
Mike
 
Consider binding the field on your parent form to a DSum() function.

Ron W
 
Hi Mike

Create a textbox in the header of footer of your subform called txtTotalFee,
with a controlsource =Sum([Fee])

Now, you can refer to this from your main form as:
Me!sbfListOfFees.Form!txtTotalFee

Note that "sbfListOfFees" is the name of the *control* on your main form
that contains the subform, not necessarily the same as the name of the form
object contained therein.

--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand

Return mail address is invalid in a vain attempt to reduce spam.
Feedback is welcome at: (e-mail address removed)
Please post new questions or followups to newsgroup.
 
Graham you rock man! That's awesome! Thank you!
Ron also thanks - I think you were saying the same thing but I need it
spelled out for me - that damned mallet...heheh

Gratitude and positive energy to both of you.

Mike

Graham Mandeno said:
Hi Mike

Create a textbox in the header of footer of your subform called txtTotalFee,
with a controlsource =Sum([Fee])

Now, you can refer to this from your main form as:
Me!sbfListOfFees.Form!txtTotalFee

Note that "sbfListOfFees" is the name of the *control* on your main form
that contains the subform, not necessarily the same as the name of the form
object contained therein.

--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand

Return mail address is invalid in a vain attempt to reduce spam.
Feedback is welcome at: (e-mail address removed)
Please post new questions or followups to newsgroup.

Blog said:
Hi All

I'm about ready to buy a rubber mallet to strike my head with over
this...so anyone who can help me will receive much gratitude and positive
energy.

I have a form with some franchisee details, and as a subform; a list all
their incurred fees.
From the main form (as a form on_current event) I want to add up the fees
listed in the subform - and store that value in a field in the main form.

For the life of me I can't seem to reference the field of the
subform
in
vb. I've tried variations of Forms!ClientList!Fee,
[Forms]![ClientList]![Fee], Forms.("ClientList").("Fee") ...etc.

**Note - I'm using the office XP version of access, and I didn't create
a new form to add as a sub I just hit the subform control button and told
the control what table to use.

Thanks in advance for any help with this
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top