I am an ASP programmer who has to make a couple of changes to an Access 2k DB that was built by someone else. I have an Access form that has a text field that needs to be automatically calculated based on the value of two other form objects. I wrote the following function, which does not work all of the time:
'Calculate the amount of the 3 checks to be cut
Private Sub NumTrip_Change()
'NumTrip will be either 1 or 2. It is a form object name
If [NumTrip] = 1 Then
'CheckCat1,2,3 are form object names
'Category 1 is a form object name
Checkcat1 = ([Category 1] * 1.12) - 500
CheckCat2 = ([Category 1] * 1.08) - 500
CheckCat3 = ([Category 1] * 1.05) - 500
ElseIf [NumTrip] = 2 Then
Checkcat1 = ([Category 1] * 1.12) - 1000
CheckCat2 = ([Category 1] * 1.08) - 1000
CheckCat3 = ([Category 1] * 1.05) - 1000
ElseIf [NumTrip] = 0 Then
Checkcat1 = 0
End If
End Sub
Any help would be greatly appreciated.
MB
'Calculate the amount of the 3 checks to be cut
Private Sub NumTrip_Change()
'NumTrip will be either 1 or 2. It is a form object name
If [NumTrip] = 1 Then
'CheckCat1,2,3 are form object names
'Category 1 is a form object name
Checkcat1 = ([Category 1] * 1.12) - 500
CheckCat2 = ([Category 1] * 1.08) - 500
CheckCat3 = ([Category 1] * 1.05) - 500
ElseIf [NumTrip] = 2 Then
Checkcat1 = ([Category 1] * 1.12) - 1000
CheckCat2 = ([Category 1] * 1.08) - 1000
CheckCat3 = ([Category 1] * 1.05) - 1000
ElseIf [NumTrip] = 0 Then
Checkcat1 = 0
End If
End Sub
Any help would be greatly appreciated.
MB