Access 2002 sales tax field

R

Rick

I need to create a sales tax field on a form that displays calculated tax on
"in state" sales and "0.00" on "out of state sales". If this can be linked to
a text field that contains the "State" abbriviation, ie "CA", "AZ", "AR",
etc., this would be ideal.
 
W

Wayne-I-M

Hi Rick

I am not sure but I think there are over 50 states and also that the tax
options may be different for each state so you may need to ignor this ??

But anyway. If the Out of state tax is applicable to "all" states other
than one where you live could use a simple IIF to appy the tax to all states
if the sufix is diiferent from one - say CA (or even a few - CA Or AZ Or AR,
etc). You would need to create a field called sales tax (or just have an
unbound box if it's for information only)


You can simply use the source for the text box like this - if there is no
tax from state AB but there is for all other states.

=IIf ( [SateField] ="AB",[SomeAmountField], [SomeAmountField]*123)

Or if there is no tax in states "AB" "CD" "EF"

=IIf ( [SateField] ="AB"Or"CD"Or"EF",[SomeAmountField],
[SomeAmountField]*123)

Something like this (note that the tax will be multiplied by 123 - so
change the rate to what it is or use a filter field if available to improve
the results if there are different tax rates in different states.)

Another way would be to use after update event

Private Sub SomeField_AfterUpdate()
If Me.State = "AB" Or "CD" Or "EF" Or "GH" Then 'add states in this row'
SalesTax = SomeAmountField * 123 'add sales tax for the above states in this
row'
Else
SalesTax = SomeAmountField * 0 'this row is for the states "not" listed above'
End If
End Sub

Or

Private Sub SomeField_AfterUpdate()
If Me.State = "AB"
SalesTax = SomeAmountField * 0
Else
SalesTax = SomeAmountField * 123
End If
End Sub


Good luck
 
R

Rick

There are indeed more than 50 Postal Code abbriviations, However, I'm only
conserned with the one for the one in which I live.

I did find a simpler statement to do what I need:

=IIf([cboState] = "FL", [txtTotal]*0.07, 0.00)

However, I need this information to record to the database.

Wayne-I-M said:
Hi Rick

I am not sure but I think there are over 50 states and also that the tax
options may be different for each state so you may need to ignor this ??

But anyway. If the Out of state tax is applicable to "all" states other
than one where you live could use a simple IIF to appy the tax to all states
if the sufix is diiferent from one - say CA (or even a few - CA Or AZ Or AR,
etc). You would need to create a field called sales tax (or just have an
unbound box if it's for information only)


You can simply use the source for the text box like this - if there is no
tax from state AB but there is for all other states.

=IIf ( [SateField] ="AB",[SomeAmountField], [SomeAmountField]*123)

Or if there is no tax in states "AB" "CD" "EF"

=IIf ( [SateField] ="AB"Or"CD"Or"EF",[SomeAmountField],
[SomeAmountField]*123)

Something like this (note that the tax will be multiplied by 123 - so
change the rate to what it is or use a filter field if available to improve
the results if there are different tax rates in different states.)

Another way would be to use after update event

Private Sub SomeField_AfterUpdate()
If Me.State = "AB" Or "CD" Or "EF" Or "GH" Then 'add states in this row'
SalesTax = SomeAmountField * 123 'add sales tax for the above states in this
row'
Else
SalesTax = SomeAmountField * 0 'this row is for the states "not" listed above'
End If
End Sub

Or

Private Sub SomeField_AfterUpdate()
If Me.State = "AB"
SalesTax = SomeAmountField * 0
Else
SalesTax = SomeAmountField * 123
End If
End Sub


Good luck


--
Wayne
Manchester, England.



Rick said:
I need to create a sales tax field on a form that displays calculated tax on
"in state" sales and "0.00" on "out of state sales". If this can be linked to
a text field that contains the "State" abbriviation, ie "CA", "AZ", "AR",
etc., this would be ideal.
 
J

John Vinson

I need to create a sales tax field on a form that displays calculated tax on
"in state" sales and "0.00" on "out of state sales". If this can be linked to
a text field that contains the "State" abbriviation, ie "CA", "AZ", "AR",
etc., this would be ideal.

Put some VBA code in the AfterUpdate event of the State control. I'd
seriously consider using a Combo Box to select the state (it could
even default to Florida if that's the bulk of your sales) rather than
a textbox though.

Try afterupdate code like

Private Sub cboState_AfterUpdate()
If Me.cboState <> "FL" Then
Me.txtSalesTax = 0
End If
End Sub

If your business expands, or salestax laws change, then you may want
to include a sales tax field in a table of states - or even in the
xipcode table, since many states have local or regional sales taxes.

John W. Vinson[MVP]
 
E

EZ KEY

John:

SORRY, BUT.... I'm Chiming in on this discussion since it invovles something
I need to do. In the great state of Ohio, every county and local district
has differnt sales taxes. My question is along the same lines. I could use
a suggestion since I'm not familiar with VBA code and I think this is what I
will need. Here is what I have:

I have setup a [Sales Tax] table with the fields: [Sales Tax ID], [Sales
Tax], [CtyOrDist]. The latter field is a name I give the sales tax either by
county or district.

I have a field in my [Order Details] table named [Sales Tax] that I want a
tax assigned to after multiplying it by the subtotal on my form. If I've
been using the 2007 Trial and found that I can add this [Sales Tax] field
from the [Order Details] table by dragging it in. Can I do that and edit the
VBA to assign that amount to it both in the form and table, or what would I
exactly have to do?
 
E

EZ KEY

Sorry, I just read about "multi-posting". I apologize for the inconsiderate
thoughts of my selfish need of resolution. I have posted this in a chimming
response to the earliery post mentioned previously under the "Forms Coding".

However, I could still use some help. Just respond to "forms coding" if I
still warrant some help. Again, my apologies to all you MVP's
that volunteer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top