Stupid question on calculations and saving result to field.

  • Thread starter Thread starter Rwahl
  • Start date Start date
R

Rwahl

Guest
Ok.. I have tried this serveral different ways.. its time to acknowledge that I am stupid and ask for help. I am taking several different fields, using certain comparisons and calculating a result. I obviously don't know how to impletement functions. IN fact.. here is what it looks like at the moment.

Function FathersSocialSecurityTax()


If Template![Father's Income] <= 65400 Then
Template![Father's Social Security tax] = Template![Father's Income] * 0.0765
ElseIf Template![Father's Income] >= 65401 Then
Template![Father's Social Security tax] = (Template![Father's Income] - 65400) * 0.0145 + 5003.1
End If

End Function

Help!!

Thank you
smile.gif


Robert.. the Access tyro
 
First it's not a good practice to use apostrophe's and spaces in control names. You will see that Access will change these to a legal character that it can use. It will also add "ctl" to a control who's first character is an integer. (enough said about that)

From what I see, this should actually be a sub routine in the form and not a function. This sub should be activated by your Fathers's Income AfterUpdate event. Here is how it should look:

Private Sub Father_s_Income_AfterUpdate()

If Me![Father's Income] <= 65400 Then
Me![Father's Social Security tax] = Me![Father's Income] * 0.0765
Else
Me![Father's Social Security tax] = (Me![Father's Income] - 65400) * _
0.0145 + 5003.1
End If

End Sub

After you enter the value in Father's Income
the sub will calculate the answer and place the result in Father's Social Security tax.

HTH
RDH

[This message has been edited by R. Hicks (edited 02-06-2000).]

[This message has been edited by R. Hicks (edited 02-06-2000).]

[This message has been edited by R. Hicks (edited 02-06-2000).]
 

Users who are viewing this thread

Back
Top Bottom