subform total in footer

Wysy

Registered User.
Local time
Today, 11:18
Joined
Jul 5, 2015
Messages
335
Hi,
i have a form with a subform in datasheet view. Subform footer has an unbound field to calculate total that is shown up in the parent form. Everything works fine as long the datasheet view is actually "shorter" than the subform height. If longer it does not and i need to click on the form to get the total. Simply setfocus on subform does not solve the problem.
any idea?
thanks
Andrew
 
What are you using as the Control Source for you calculated, unbound Control?

The number of Records in your Subform, whether they are less in number than your Subform can show at one time...or more in number than can be displayed at one time...should not make a difference!

Linq ;0)>
 
Agree with Linq.

The count should show correctly no matter how many records actually show. Works for me and I don't have to click on form.
 
thank for the inputs.
Actually it is not a count but a sum, but i have tested with the count: same thing.
It is clearly an issue with the number of shown records, making the subform smaller inducing the error.
So the subform record source is a table but checked it with query too.
Form footer (tested with page footer too) has an unbound control with
=Sum(total) control source.
Form current vba code contains the following
me.parent.txtSum=me.txtTotal
Just to be exact: if the shown records "fit" in subform it work ok, if not it fail and i need to click on subform. But then it works.
Of course to have a dsum functioned unbound control on main form to achieve what i want works normally without the question of number of records.
I have tried to see what happens on the way by using msgbox. It seems the subform form footer control is not calculated if the record number "exceed" the subform window. I have also included a setfocus code to have subform in focus: no success.
 
Again, cannot replicate issue. If you want to provide db for analysis, follow instructions at bottom of my post.
 
I got it solved, but i am still wonder what causes this issue.
So i turned around the "refering direction" meaning that i have changed the control source on the main form:
=fsubform!control
It works now perfectly.
But what causes a vba code to run depending on the number of records visible?
What causes a vba Form Current code not to run depending on a subform size?
 
sorry the control source is
=fsubform.Form!control
 
Glad you figured it out. I just noticed you said you were using VBA.
 

Users who are viewing this thread

Back
Top Bottom