473,418 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Problem with totals on subforms

Ron
Hi All,

I've got a main form (frmMain) with 5 subforms on it. All subforms are
linked to different hidden controls on frmMain. The purpose of this form is
to record payments by 'source' (batches) so frmMain's source is a query on
BatchPaymentID. New 'source' for payment, new BatchPaymentID. 1st subform
(sfrmOne) is a client list of just the client's that would have that source
of payment. Next subform (sfrmTwo) is a list of charges (from the regular
transactions file) for the selected ClientID from sfrmOne. Select a charge
and it drops down to the payment subform...(sfrmThree) where the operator
can enter a payment and an adjustment should the payment not pay the charge
in full. Payments record into a table called tblPayAdjTransactions and then
will later (when all the payments entered equals the total for the check and
some other error trappings are done) post into the regular transactions file
(not there yet though).

So, all this works so far. No problems. Now we get to what doesn't work.

I have another subform, hidden, that I want to use as a "Total Payments"
kinda form (frmFour). It's linked to frmMain by the BatchPaymentID and
totals up all the payments, regardless of client from tblPayAdjTransactions
(on a query, of course). That way, I could have a running total of all
payments for the current batch, and display that on the main form. It
works, when the form initially loads (so, if all the payments equals $837.52
when I first open frmMain, I get that in the "Total of Payments" control on
the frmMain. And it works when one of the payments already recorded is
changed to a different amount. Change a $40 payment to $30 and the "Total
of Payments" control on frmMain changes to $827.52. But it DOES NOT update
when I add a new payment into tblPayAdjTransactions via sfrmThree, nor if I
change that just entered payment. Before the "Total Payments" control on
frmMain updates, I have to close frmMain and reopen it.

With this info, can someone suggest where I need to put whatever so that the
hidden form will update when records are added? I have another hidden form
that does the same thing, except it links by BatchPaymentID;ClientID and it
works the same way. Works fine when frmMain is loaded. Works fine if an
existing payment is changed. But DOES NOT update when a payment is added.

I've tried requerying the hidden forms, but nothing seems to work. I've
tried all the usual places, like Form_AfterUpdate, Form_AfterInsert all in
the sfrmThree form, etc--all still not working. In trying to get this done,
I've tried:
Forms!frmMain!sfrmFour!TotalOfPayments.Requery

Suggestions? Is there an easier way to do running subtotals for different
purposes as I've indicated? Need more info to be able to help?

TIA
ron
Aug 29 '07 #1
2 1743
Ron wrote:
Hi All,

I've got a main form (frmMain) with 5 subforms on it. All subforms are
linked to different hidden controls on frmMain. The purpose of this form is
to record payments by 'source' (batches) so frmMain's source is a query on
BatchPaymentID. New 'source' for payment, new BatchPaymentID. 1st subform
(sfrmOne) is a client list of just the client's that would have that source
of payment. Next subform (sfrmTwo) is a list of charges (from the regular
transactions file) for the selected ClientID from sfrmOne. Select a charge
and it drops down to the payment subform...(sfrmThree) where the operator
can enter a payment and an adjustment should the payment not pay the charge
in full. Payments record into a table called tblPayAdjTransactions and then
will later (when all the payments entered equals the total for the check and
some other error trappings are done) post into the regular transactions file
(not there yet though).

So, all this works so far. No problems. Now we get to what doesn't work.

I have another subform, hidden, that I want to use as a "Total Payments"
kinda form (frmFour). It's linked to frmMain by the BatchPaymentID and
totals up all the payments, regardless of client from tblPayAdjTransactions
(on a query, of course). That way, I could have a running total of all
payments for the current batch, and display that on the main form. It
works, when the form initially loads (so, if all the payments equals $837.52
when I first open frmMain, I get that in the "Total of Payments" control on
the frmMain. And it works when one of the payments already recorded is
changed to a different amount. Change a $40 payment to $30 and the "Total
of Payments" control on frmMain changes to $827.52. But it DOES NOT update
when I add a new payment into tblPayAdjTransactions via sfrmThree, nor if I
change that just entered payment. Before the "Total Payments" control on
frmMain updates, I have to close frmMain and reopen it.

With this info, can someone suggest where I need to put whatever so that the
hidden form will update when records are added? I have another hidden form
that does the same thing, except it links by BatchPaymentID;ClientID and it
works the same way. Works fine when frmMain is loaded. Works fine if an
existing payment is changed. But DOES NOT update when a payment is added.

I've tried requerying the hidden forms, but nothing seems to work. I've
tried all the usual places, like Form_AfterUpdate, Form_AfterInsert all in
the sfrmThree form, etc--all still not working. In trying to get this done,
I've tried:
Forms!frmMain!sfrmFour!TotalOfPayments.Requery

Suggestions? Is there an easier way to do running subtotals for different
purposes as I've indicated? Need more info to be able to help?

TIA
ron

In your form's afterUpdate event of subf3 maybe you need to requery
sfrmFour. I have no idea on how the value is being updated into the
Main form. Maybe
Forms!mainform!subform4.Requery
Forms!Mainform!TotalPays = Forms!mainform!subform4!TotalPays

Do you really need sf4? Probably not. You could have the control
source be something like (air code)
=NZ(Dsum("PayAmt","Transactions","BatchID = " & [BatchID]),0)
or write a function to total the transactions called SumTXs and in the
control that displays to totals enter
=SumTxs()
so that when you add something in SF3, in the afterupdate event you enter
Forms!MainForm!TotalsField.Requery
Aug 29 '07 #2
Ron

"Salad" <oi*@vinegar.comwrote in message
news:13*************@corp.supernews.com...
Ron wrote:
>Hi All,

I've got a main form (frmMain) with 5 subforms on it. All subforms are
linked to different hidden controls on frmMain. The purpose of this form
is to record payments by 'source' (batches) so frmMain's source is a
query on BatchPaymentID. New 'source' for payment, new BatchPaymentID.
1st subform (sfrmOne) is a client list of just the client's that would
have that source of payment. Next subform (sfrmTwo) is a list of charges
(from the regular transactions file) for the selected ClientID from
sfrmOne. Select a charge and it drops down to the payment
subform...(sfrmThree) where the operator can enter a payment and an
adjustment should the payment not pay the charge in full. Payments
record into a table called tblPayAdjTransactions and then will later
(when all the payments entered equals the total for the check and some
other error trappings are done) post into the regular transactions file
(not there yet though).

So, all this works so far. No problems. Now we get to what doesn't
work.

I have another subform, hidden, that I want to use as a "Total Payments"
kinda form (frmFour). It's linked to frmMain by the BatchPaymentID and
totals up all the payments, regardless of client from
tblPayAdjTransactions (on a query, of course). That way, I could have a
running total of all payments for the current batch, and display that on
the main form. It works, when the form initially loads (so, if all the
payments equals $837.52 when I first open frmMain, I get that in the
"Total of Payments" control on the frmMain. And it works when one of the
payments already recorded is changed to a different amount. Change a $40
payment to $30 and the "Total of Payments" control on frmMain changes to
$827.52. But it DOES NOT update when I add a new payment into
tblPayAdjTransactions via sfrmThree, nor if I change that just entered
payment. Before the "Total Payments" control on frmMain updates, I have
to close frmMain and reopen it.

With this info, can someone suggest where I need to put whatever so that
the hidden form will update when records are added? I have another
hidden form that does the same thing, except it links by
BatchPaymentID;ClientID and it works the same way. Works fine when
frmMain is loaded. Works fine if an existing payment is changed. But
DOES NOT update when a payment is added.

I've tried requerying the hidden forms, but nothing seems to work. I've
tried all the usual places, like Form_AfterUpdate, Form_AfterInsert all
in the sfrmThree form, etc--all still not working. In trying to get this
done, I've tried:
Forms!frmMain!sfrmFour!TotalOfPayments.Requery

Suggestions? Is there an easier way to do running subtotals for
different purposes as I've indicated? Need more info to be able to help?

TIA
ron
In your form's afterUpdate event of subf3 maybe you need to requery
sfrmFour. I have no idea on how the value is being updated into the Main
form. Maybe
Forms!mainform!subform4.Requery
Forms!Mainform!TotalPays = Forms!mainform!subform4!TotalPays

Do you really need sf4? Probably not. You could have the control source
be something like (air code)
=NZ(Dsum("PayAmt","Transactions","BatchID = " & [BatchID]),0)
or write a function to total the transactions called SumTXs and in the
control that displays to totals enter
=SumTxs()
so that when you add something in SF3, in the afterupdate event you enter
Forms!MainForm!TotalsField.Requery

Hi Salad,

Thanks for the quick reply.

As you'll note from the original post, I did try the requery on sfrmFour but
slightly differently (with the control I'm looking for). Just tried your
way (without the control) and it works fine now...sheezzz... hours I've been
working on this! I'll put that same requery in a couple more places and
it'll do exactly what I want for what I've got so far. But I think I'll
play around with what else you've suggested to see if it'll work any
easier/faster/better.

Thanks again!
ron
Aug 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
1
by: William Bradley | last post by:
At the moment I am having a problem with relationships and updating tables. The following is a production run. Table1 -- MainFormTable1 -- Basic Table Record Table2 ----SubFormTable2 --...
3
by: Evil | last post by:
Hi, i have a problem with a treeview and some subforms in MS Access97. I have a form with a treeview on the left side which lets me navigate thru some projects. Then on the right side, i have...
7
by: Ken Mylar | last post by:
First a quick background on the form: I have a form that is normally viewed in Single form mode. It has a subform on it that is in datasheet view. The main form is for work orders and the...
10
by: rdemyan via AccessMonster.com | last post by:
I have a subform that displays around 10 fields. Most of the values shown result from some complex calculations. To make it easy, I have stored the results in a temporary table and then all I...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
1
by: Nasher | last post by:
This is so frustrating becuase i know this has a simple solution, but i just cant get it to work! Basically i have several subforms on a page (continuous forms) and they all have a simple sum...
2
by: warpcon | last post by:
I have a main form with a subform on it. The subforms columns are Qty , Part # , Description , Unit Price , and Ext Price. I put a text box on my main form named Total. I got the ext price to add up...
7
by: IntelSldr | last post by:
Background: database is simple and controlled by one form with multiple tabs that include subforms under each tab. I have a totals row in a subform that counts the number of rows above it in order...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.