I've tried to create a Form to Calculate Sales and Taxes, but I'm not able to get the form to work. Super new to vba, off and on for a few years and its now become imperative for me to get this done. This is the code i have so far.
Private Sub txtSalesTax_Change()
Me.txtSubtotal.Text = Val(Replace(txtSalesPrice.Text, "$", "")) * Val(Replace(txtSalesTax.Text, "%", "")) / 100
End Sub
Private Sub txtSubtotal_AfterUpdate()
Me.txtSubtotal.Value = Format(txtSubtotal.Text, "$0,00")
End Sub
Private Sub txtSalesTax_AfterUpdate()
Me.txtSalesTax.Text = Val(txtSalesTax.Value) / 100
Me.txtSalesTax.Text = Format(txtSalesTax, "Percent")
End Sub
Private Sub txtTotalSale_Values()
Dim dbltxtTotalSale As Double
On Error Resume Next
dbltxtTotalSale = CDbl(txtSubtotal.Value)
dbltxtTotalSale = dbltxtSubtotal + CDbl(PriceIncrease.Value) - CDbl(txtSubtotal.Value)
dbltxtTotalSale = dbltxtTotalSale + CDbl(PriceIncrease.Value)
txtTotalSale.Value = dbltxtTotalSale
txtTotalSale = Format(txtTotalSale, "$0.00")
End Sub
Could you please outline your process a little more?
For example, which text boxes are you allowing users to enter data into? Which ones are locked? Do you have any other controls on the form? Is your form bound to a table or recordset?
-Tala-