Access 2002 Form 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.
 
A

Arvin Meyer [MVP]

Add a textbox to your form for the sales tax. Set the controlsource to:

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

substitute the name of your state control for cboState, your total control
for txtTotal, and the proper state and sales tax.
 
R

Rick

Thanks Alvin. The statement works great. Now, is there a way to get this
information to record to s database?

Arvin Meyer said:
Add a textbox to your form for the sales tax. Set the controlsource to:

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

substitute the name of your state control for cboState, your total control
for txtTotal, and the proper state and sales tax.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

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.
 
A

Arvin Meyer [MVP]

Unless you need to keep history of a sales for more than a year, you do not
need to record the tax since it will always be recalculated. If you do need
to store it, use some code in the AfterUpdate event of the state field to
write it to a bound control, instead of a calculated one:

Sub cboState AfterUpdate()
If Me.cboState = "FL" Then
Me.txtTax = 0.07*Me.txtTotal
Else
Me.txtTax = 0
End If
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Rick said:
Thanks Alvin. The statement works great. Now, is there a way to get this
information to record to s database?

Arvin Meyer said:
Add a textbox to your form for the sales tax. Set the controlsource to:

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

substitute the name of your state control for cboState, your total
control
for txtTotal, and the proper state and sales tax.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

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.
 
H

HiTechCoach via AccessMonster.com

Ypu really should not store the calculation. You do need to store the tax
rate in the record so that ypu can calculate the total sales tx as needed.


Thanks Alvin. The statement works great. Now, is there a way to get this
information to record to s database?
Add a textbox to your form for the sales tax. Set the controlsource to:
[quoted text clipped - 8 lines]
 
Top