-
Hi
I have this formula that is suppose to look at two fields and determine if both are under the value, if the values are under the other value then it should write MFG DEFECT in the txtfields(8).
If Val(txtFields(5).Text) < 7.2 And Val(txtFields(7).Text) < Val(txtFields(4).Text) Then
txtFields(8) = "MFG DEFECT"
End If
It does not do that though, actually it doesn't do anything. I was wondering if someone could help me out with this?
Thanks
jeffro
-
Add another set of parenthesis'
Code:
If Val(txtFields(5).Text) < 7.2 And (Val(txtFields(7).Text) < Val(txtFields(4).Text)) Then
txtFields(8) = "MFG DEFECT"
End If
-
No that didn't help either, nice try though!
jeffro
-
Ok, add the following line, and if the problem doesn't become obvious, post the results of the immediate window back here and I'll take a look.
Code:
Debug.Print "If " & Val(txtFields(5).Text) & " < 7.2 And " & Val(txtFields(7).Text) & " < " & Val(txtFields(4).Text) & " Then"
If Val(txtFields(5).Text) < 7.2 And Val(txtFields(7).Text) < Val(txtFields(4).Text) Then
txtFields(8) = "MFG DEFECT"
End If
-
jmcswain,
I have all this in the lost focus event:
If Val(txtFields(5).Text) < 7.2 Then
txtFields(8).Text = "CCA"
Else
If Val(txtFields(7).Text) < Val(txtFields(4).Text) Then
txtFields(8) = "RCT"
Else
If Val(txtFields(5).Text) < 7.2 And (Val(txtFields(7).Text) < Val(txtFields(4).Text)) Then
txtFields(8) = "MFG DEFECT"
End If
End If
End If
If Val(txtFields(5).Text) > 7.2 Then
txtFields(8).Text = ""
Else
If Val(txtFields(7).Text) > Val(txtFields(4).Text) Then
txtFields(8) = ""
End If
End If
My code seem to be working fine and now it is not work correctly at all. I'm having problems with getting the right (CCA, RCT, MFGDEFECT) to show up. Can you help me out, please?
thanks alot jeffro