Subform Sum when null

new_2_prog

Registered User.
Local time
Today, 12:54
Joined
Aug 4, 2008
Messages
58
I have a subform called Line Items that contains fields description, count, and price. This subfrm doesn't always contain data but yet there is a grand total field in the form footer.
My problem is if there is no data I need this grand total field to equal 0, I have tried a couple things that haven't worked.
Can someone provide code because this grand total is carried over to the main form and if it is null then I have additional issues.
Thanks! :confused:
 
can you do an if isnull(yoursumfield), "", yoursumfield)??
 
where would I do this? In VB or in the properties?
 
The subform is based on the table and then when the subfrm was added to the main form the links were based on the quoteid field
 
i did as the control source of the grand total field:
=If([Controls_Detail_Line_Qty]="",0,(Sum([Controls_Detail_Line_Qty]*[Controls_Detail_Line_Amnt]))) - even tried =If([Controls_Detail_Line_Qty]is null,0,(Sum([Controls_Detail_Line_Qty]*[Controls_Detail_Line_Amnt])))
neither worked
 
ok you can create an unbound textbox and put that on the form with its controlsource like i showed above. then if you want, you can make the other sum field visible=no
 
Ok, I left the grand total box with the control source as:
=Sum([Controls_Detail_Line_Qty]*[Controls_Detail_Line_Amnt])
Then I created a new unbound box with the control source as:
=If([subfrm_grand_total]="",0,[subfrm_grand_total])
I get #Name? is the new unbound box
 
I did code when the subform loads:
Private Sub Form_Load()
If Me.grand_total = "" Then
Me.subfrm_grand_total = 0
Else
Me.subfrm_grand_total = Me.grand_total
End If
End Sub

This worked. Thanks!!
 
ok if you do it this way you want to use

=iif([subfrm_grand_total]="",0,[subfrm_grand_total])
 

Users who are viewing this thread

Back
Top Bottom