Transfering Data from a subform to a parent form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have developed a purchase order form which has a subform that is the
itemized list of of purchases. On this subform I have a footer with an
unbound text box (Total) with this formula in it =(Sum([DebitAmount])).
This works well except it only updates when I go to add the next item on the
subform.

I would like to transfer this total to the parent form txtSubtotal text box
for further calculations.
 
Kevin said:
I have developed a purchase order form which has a subform that is the
itemized list of of purchases. On this subform I have a footer with an
unbound text box (Total) with this formula in it =(Sum([DebitAmount])).
This works well except it only updates when I go to add the next item on the
subform.

I would like to transfer this total to the parent form txtSubtotal text box
for further calculations.

The parent form can use a text box expression such as:
=subform.Form.Total

The subform record must be saved before the total can be
updated. Going to any other record is one action theat will
force a record to be saved.
 
I have tried this expression with no results.

One way I solved the problem was to enter "Parent!Total = Me!Subtotal" in
the Lost Focus event of the Subtotal text box. Is there a way in code to
change the focus of that text box so that event is performed automaticly
instead of having to put the curser in that field and then remove it to
update the total field

Kevin

Marshall Barton said:
Kevin said:
I have developed a purchase order form which has a subform that is the
itemized list of of purchases. On this subform I have a footer with an
unbound text box (Total) with this formula in it =(Sum([DebitAmount])).
This works well except it only updates when I go to add the next item on the
subform.

I would like to transfer this total to the parent form txtSubtotal text box
for further calculations.

The parent form can use a text box expression such as:
=subform.Form.Total

The subform record must be saved before the total can be
updated. Going to any other record is one action theat will
force a record to be saved.
 
In my experience, that approach doesn't always work (it's a
timing thing).

If you force the new/modified record to be saved, everything
is supposed to update automatically. I don't have any idea
where/when you would want to save the record (maybe a
button???), but the code is simply:
If Me.Dirty Then Me.Dirty = False
--
Marsh
MVP [MS Access]

I have tried this expression with no results.

One way I solved the problem was to enter "Parent!Total = Me!Subtotal" in
the Lost Focus event of the Subtotal text box. Is there a way in code to
change the focus of that text box so that event is performed automaticly
instead of having to put the curser in that field and then remove it to
update the total field

Marshall Barton said:
Kevin said:
I have developed a purchase order form which has a subform that is the
itemized list of of purchases. On this subform I have a footer with an
unbound text box (Total) with this formula in it =(Sum([DebitAmount])).
This works well except it only updates when I go to add the next item on the
subform.

I would like to transfer this total to the parent form txtSubtotal text box
for further calculations.

The parent form can use a text box expression such as:
=subform.Form.Total

The subform record must be saved before the total can be
updated. Going to any other record is one action theat will
force a record to be saved.
 
In the subform control's AFTER UPDATE event, put use the "Refresh" command - this will force the subform to update it's recordset/table. Right underneath the Refresh command you can put the code to update the parent form's box.

Hope I understood your problem, and hope that I actually helped!

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
Back
Top