We help IT Professionals succeed at work.
Get Started

Calculating Sales Tax

Last Modified: 2017-05-11
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
Watch Question
Distinguished Expert 2020
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE