Help with If

gguy

Registered User.
Local time
Today, 00:30
Joined
Jun 27, 2002
Messages
104
I need a little help with an if statement. I am trying to show that a product is accepted or rejected if it falls within a tolerance ([tol]) range. If I take " AND >= -([Tol])" out of the statement then the if statement works. If [Tol] was .01 then accepted would be from -0.01 to 0.01. What do I need to change to get this range in the if statement?

Also, I placed the IF in the GotFocus of the accept/reject field on the form, so, A or R does not show in the field until I tab to it. I have a field called [Observered] which is the last field, that is part of the calc, that is checked against the tolerance. Will this IF work in the LostFocus there?

The If is as follows:

Private Sub Acc_Rej_GotFocus()

If [difference] <= [Tol] AND >= -([Tol]) Then [acc/rej] = "A" Else [acc/rej] = "R"

End Sub

Thanks, GGuy
 
If [difference] <= [Tol] AND [difference] >= -[Tol] Then
[acc/rej] = "A"
Else
[acc/rej] = "R"
End If

HTH
 
Ouch! that was pretty obvious. I just changed it to an IIF, that seems to work better anyway. Thanks for your help. GGuy
 

Users who are viewing this thread

Back
Top Bottom