Calculations for Unbound Textboxes

amerfeld

Registered User.
Local time
Today, 13:35
Joined
Aug 17, 2004
Messages
58
Hi all:
I have searched for a solution to this but haven't found quite what I need. I have a report with an OrderNo header and footer. There is an unbound textbox in the detail section which calculates a value using the code below. The code runs at the onformat event of the detail section. Here is the code for the unbound textbox (named txtTtlMin):

If CstDesc = "masking" Then
txtTtlMin = PPMMPP * ReceiptQty
ElseIf CstDesc = "prefinish" Then
txtTtlMin = PPMMPP * ReceiptQty
Else
txtTtlMin = ReceiptQty / PPMMPP
End If

This works fine. What I need to do is calculate the sum of the txtttlmin textbox in the order no footer section. Not sure how to do this. Can anyone help? Thanks.
 
Someone, puhleeeeeeeese, must know the answer to this one. If you need clarification, let me know. Thanks!:)
 
I don't see the point of using vba to do this, a calculated control will do the same.
To sum the control you need to repeat the calculation ie
Sum([Item]*[Quantity] or use the running sum property of a hidden textbox
 
Rich:
Thanks for your reply. If you look at the code again, you'll see the calculation is dependent upon what type of operation is being used. Any other ideas?
 
A calculated expression with an Iif statement will do the same thing, to Sum them you just need Sum(Iif + Sum(Iif etc or again an unbound hidden textbox with the RunningSum property set to overall
 
Rich: Apparently I haven't had enough coffee yet this morning and need you to please spell things out for me. For the calculated expression, do I need to put that in a control or in the footer section under the onformat event? Also, not quite sure how the hidden unbound control ties in. I haven't really ever used an IIF statement so I think this is where my knowledge is lacking (maybe in several other areas as well :) )Thanks again!
 
=Sum(Iif(([CstDesc] = "masking" Or "prefinish" ),[PPMMPP] * [ReceiptQty],[ReceiptQty] / [PPMMPP]))
 
Thanks Rich. Before you replied, I went into the underlying query and created a field with a nested IIF statement to use instead of the unbound control in the detail section of the report. Then on the report, because I now had a control with a control source, I was able to sum the control in the footer section. (Hope that makes sense for anyone following). All is happy now. Thanks again.
 

Users who are viewing this thread

Back
Top Bottom