Ok I have been customizing this DB for a long time. Basically it is an invoice form, so... I have the tax rates hard coded for calculation. My business is in three states, so I have three different tax rates. Here is my VBA code for this section.
Now because our tax rates keep changing constantly this is getting to be a pain to update. I have added a new table called "tax" with two fields named "taxstate" which is the Primary key and "taxrate" which is a decimal field. Three records in that table are as follows,
taxstate - taxrate
TN - 0.0975
FL - 0.06
NC - 0.0825
What I am trying to do is change the hard coded tax rate in the code block above so that it pulls the "taxrate" from the new "tax" table if the "taxstate" equals the respective state.
Any help on this will be greatly appreciated
Code:
If Me!StateIn = "TN" Or Me!ShiptoState = "TN" Then
Me!Tax = (Me!PartTTL + Postage + LaborTTL - Discount) * 0.0975
ElseIf Me!StateIn = "FL" Or Me!ShiptoState = "FL" Then
Me!Tax = (Me!PartTTL + Postage + LaborTTL - Discount) * 0.06
ElseIf Me!StateIn = "NC" Or Me!ShiptoState = "NC" Then
Me!Tax = (Me!PartTTL + Postage + LaborTTL - Discount) * 0.0825
Else: Me!Tax = "0.00"
End If
taxstate - taxrate
TN - 0.0975
FL - 0.06
NC - 0.0825
What I am trying to do is change the hard coded tax rate in the code block above so that it pulls the "taxrate" from the new "tax" table if the "taxstate" equals the respective state.
Any help on this will be greatly appreciated
Comment