Good Morning,
I have been trying to resolve this error with my sum on the form footer of my orders Subform for a couple of hours. It was working fine when I was just totaling the unit price * the quantity but now when I added the tax textbox it's not calculating correctly. Does anyone have any advise. I would really appreciate it. Basically I have an order form with an Orders Subform contained within it. I wanted to be able to apply a tax to certain items so I created a tax check box and I VBA coded an if statement to apply tax if the checkbox is checked. I created a field to display the tax amount per item with a control source of tax from my orders table. When I check the checkbox my total price changes but my form total stays the same because it's working off of the unit price * quantity. I figured I could just add the TaxTextBox field to the sum in the form footer but no matter how I phrase it I either get an error or an incorrect total. What is wrong with my logic here? I would appreciate any advise. See code below:
=Sum(Nz(([UnitPrice]*[Qty]),0))+Nz([TaxTextBox],0)
Does it have something to do with the VBA coding for tax check box... I have the following VBA in tax check box..
If TaxCheckbox = True Then
Me.TaxTextBox = Me.ProdTotal * 0.07
Me.ProdTtl.Requery
Me.Refresh
DoEvents
Me.Parent.Subtotal = Round(Me.ProdTtl, 2)
Me.Parent.OrderTotal = Me.Parent.Subtotal + Nz(Me.Parent.DeliveryFee)
Else
Me.TaxTextBox = 0
End If
I have been trying to resolve this error with my sum on the form footer of my orders Subform for a couple of hours. It was working fine when I was just totaling the unit price * the quantity but now when I added the tax textbox it's not calculating correctly. Does anyone have any advise. I would really appreciate it. Basically I have an order form with an Orders Subform contained within it. I wanted to be able to apply a tax to certain items so I created a tax check box and I VBA coded an if statement to apply tax if the checkbox is checked. I created a field to display the tax amount per item with a control source of tax from my orders table. When I check the checkbox my total price changes but my form total stays the same because it's working off of the unit price * quantity. I figured I could just add the TaxTextBox field to the sum in the form footer but no matter how I phrase it I either get an error or an incorrect total. What is wrong with my logic here? I would appreciate any advise. See code below:
=Sum(Nz(([UnitPrice]*[Qty]),0))+Nz([TaxTextBox],0)
Does it have something to do with the VBA coding for tax check box... I have the following VBA in tax check box..
If TaxCheckbox = True Then
Me.TaxTextBox = Me.ProdTotal * 0.07
Me.ProdTtl.Requery
Me.Refresh
DoEvents
Me.Parent.Subtotal = Round(Me.ProdTtl, 2)
Me.Parent.OrderTotal = Me.Parent.Subtotal + Nz(Me.Parent.DeliveryFee)
Else
Me.TaxTextBox = 0
End If
Last edited: