By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,704 Members | 1,944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,704 IT Pros & Developers. It's quick & easy.

Subform Footer Totals Problem

100+
P: 166
Happy Friday!

I was wondering if you can have more than one total in the footer. I ask this because when I set up one of my totals in the footer (lets call it total1), it works (slowly but it works)...but when I set up the other one (total2), I get an error for the total1 value and an error for the total2 value.

I have a function, GetYield, that returns a calculation based on the material chosen (matType).
Public Function GetYield(matType As Integer, BatchWeight As Double, MatGrav As Double) As Double
'returns the yield of each material 'DM_yield' calculation

Select Case matType
'Cement, Coarse, Fine, Pigment
Case 1, 2, 3, 4
GetYield = BatchWeight / (MatGrav * 62.4)
'Chemicals
Case 5
GetYield = (BatchWeight / 128) * (10 / 62.4)
Case Else
GetYield = 0
End Select
End Function

I call this function in a query, which is the control source for the subform:
SELECT MixSample.DM_Mix, MixSample.DM_MaterialNo, MixSample.matTypeID, MixSample.materialID, MixSample.matBatchWeight, MatType.matType, Material.material, Material.materialGrav, GetYield([MixSample].[matTypeID],[matBatchWeight],[materialGrav]) AS DMYield, MixSample.pigPercent FROM MixDesign INNER JOIN (Material INNER JOIN (MixSample INNER JOIN MatType ON MixSample.matTypeID = MatType.matTypeID) ON Material.materialID = MixSample.materialID) ON MixDesign.DM_Mix = MixSample.DM_Mix;

I have a bound text box on my subform whose control source is the calculated field in the query, called DMYield.
In my footer, I have an unbound text box, txtSumDMyield, that is supposed to get the total sum of the DMyield field (named DM_yield) in the form. the control source of the txtSumDMYield field is:
=Sum([DMyield]), which only sometimes returns a value.
Currently, it is not returning any thing...

When I tried to include an unbound text box which also calculated the sum of another field on the form, total1 stopped working and gave me a #error, along with the total2 value equaling #error. total2's sontrol source was similar to total1, =Sum([DM_MixCost]). The unbound text box for DM_MixCost value is also determined by a function. The function returns correct values, but when it comes to getting a total sum for them, I get an error.

Any ideas how I can get BOTH totals working?

Thank you
Dec 5 '08 #1
Share this Question
Share on Google+
1 Reply


100+
P: 166
I figured it out, thanks!
Dec 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.