Sub Form to Text Box

Craig_Withers

New member
Local time
Today, 12:01
Joined
Jul 21, 2004
Messages
7
I've got a rather complicated problem with Access 97 here, at least it seems cpmplicated to me!

The main form on my database, called frmMain has a subform on it (running from a query) which lists payments or contributions made, I've got that working fine so that the payments shown on the subform change as the user switches through the records.
However, I've got another subform, which runs from a query which totals the payments made by each company, so the user can see at a glance how much each company has paid. In can put the second subform on frmMain, showing only the Total, however the formatting isn't ideal, and I don't like the way it looks when the form is printed.
To remedy this, I've placed a text box on frmMain and I've tried to manually link it through to the contributions total subform, by setting the Control Source to "=[Forms]![frmPreContribTotal subform]![SumOfContribAmount]"
My problem is that, while this does work in that it shows the very first entry i.e. the Sum for the first record in the subform, it doesn't change as the user moves through the records on frmMain.

I know this is quite a long post, and I've probably not made it as straighforward as others, but I'd appreciate any help I can get!
 
Use the Current event of the SubForm and set Me.Parent.txtBoxTotal = whatever.
 
Thanks for the help, but I can't seem to get it to work...

The text box on the subform which holds the info I want is called 'SumOfContribAmount', the text box on the main form I want to pass this info to is called txtPreTotal.
In the Current event of the subform, I've put the following, "Me.Parent.txtPreTotal = SumOfContribAmount" however, when I open the main form up, I'm getting the following error message,
"Run-time error 2452: The expression you entered has an invalid reference to the Parent property. For example, you may be using the Parent property with a control on a main form or report rather than with a control on a subform or subreport."
 
Me.Parent.txtPreTotal = Me.SumOfContribAmount
 
You don't need a second subform or query, a calculated control in the first subform footer will do.
=Sum([your field])
 

Users who are viewing this thread

Back
Top Bottom