Get SumTotals from Subform

K

katz

Hello,
I have a Mainform with a Subform with details. In the subform I have a
control name 'Amount ' and in the Form footer I have TotAmt using Sum to get
the total of all the detail Amounts, and on the MainForm I display the
TotAmt field.
The problem is, the Sum(TotAmt) control gets updated only when the user tabs
to the next record.
Many time the user will press a button (for processing) on the Main form,
before going to the next record on the Detail and I don't have the sum of
all detail records yet.
How can I get the correct sum for TotAmt as they press the button on the
Main form, because on the On click event I need the correct Sum(TotAmt). I
tried to add the saveRecord right in the beginning, but it doesn't work.
Thanks
Abe
 
B

Beetle

You could try adding a line of code at the beginning of your main form
buttons OnClick event like;

Me.[NameOfYourSubfomControl].Form.Dirty = False

HTH
 
K

katz

Hi Sean, thanks for your reply, but it doesn't work. I have to press twice
the button on the main form, in order the totalAmt should change.
Is there another way?
Thanks

Beetle said:
You could try adding a line of code at the beginning of your main form
buttons OnClick event like;

Me.[NameOfYourSubfomControl].Form.Dirty = False

HTH
--
_________

Sean Bailey


katz said:
Hello,
I have a Mainform with a Subform with details. In the subform I have a
control name 'Amount ' and in the Form footer I have TotAmt using Sum to
get
the total of all the detail Amounts, and on the MainForm I display the
TotAmt field.
The problem is, the Sum(TotAmt) control gets updated only when the user
tabs
to the next record.
Many time the user will press a button (for processing) on the Main form,
before going to the next record on the Detail and I don't have the sum of
all detail records yet.
How can I get the correct sum for TotAmt as they press the button on the
Main form, because on the On click event I need the correct Sum(TotAmt).
I
tried to add the saveRecord right in the beginning, but it doesn't work.
Thanks
Abe
 

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

Top