Access 2000

D

Dennis

I am trying to write a code to calculate payroll witholding taxes for my
business
I am having problems getting a code to proper calculate from a push button
created. My code lokks like this

If (gross pay *26-3200-9800 )>9800 then
Federal tax = gross pay *26-3200-9800 *.15 + 715 /26

If my Gross pay =$800.00, my fedral tax should compute from code equal 72.50

Can you help me, or is there any articles on the subject matter payroll tax
code for Access

Thanks
 
T

Tom Wickerath

Hi Dennis,

I'm a bit stumped on how you are evaluating this expression:
gross pay *26-3200-9800

with a gross pay of $800 and getting it to pass a test for greater than
9800. When I run this calculation, I'm getting $7800. Here is an example of
using a SELECT Case construct, where you can provide ranges. The lower value
of the range must be listed first:

Option Compare Database
Option Explicit

Function CalcFedTax(curGrossPay As Variant) As Currency
On Error GoTo ProcError

Dim curAdjPay As Currency

If IsNull(curGrossPay) Then
CalcFedTax = 0
Else
curAdjPay = curGrossPay * 26 - 3200 - 9800

Select Case curAdjPay
Case 7000 To 7999.99
CalcFedTax = (curAdjPay * 0.15 + 715) / 26
Case Else
'CalcFedTax = "Your first born child" <---Just kidding
End Select

End If

ExitProc:
Exit Function
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in CalcFedTax Function..."
Resume ExitProc
End Function


Note: The curGrossPay field is assumed to be a currency datatype.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

:

I am trying to write a code to calculate payroll witholding taxes for my
business
I am having problems getting a code to proper calculate from a push button
created. My code lokks like this

If (gross pay *26-3200-9800 )>9800 then
Federal tax = gross pay *26-3200-9800 *.15 + 715 /26

If my Gross pay =$800.00, my fedral tax should compute from code equal 72.50

Can you help me, or is there any articles on the subject matter payroll tax
code for Access

Thanks
 

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