Thank you for the fast reply....
So far, I have 3 tables. The tblMain table contains Part#, mfgLot#, phaselot#, phase. There are other fields, but these make up the primary key. The tblTests table contains Part#, mfglot#, phaselot#, phase, machine#, operator, TestDate, time1, time2, time3, time4, timestatus..etc. the relationship is one-to-many between these tables. The tblSpecs table contains Phase, RangeMin, and RangeMax. This is a one-to-one relationship to the tblTests table. One product can have many tests because if it fails, the user must rework the product and test again. The specs are pretty straight forward. There's a low end and a high end. Anything within this range, the product passes. And it fails, if it is out of range.
I created a main form with the fields from the tblMain and a subform with the fields from the tblTests. The subform is in a datasheet view so I see multi tests for a particular product.
This is what I have in the On-Enter Event of the TimeStatus field. It doesn't work, but I was trying anything that I can think. I just hard code the specs in there, cause I have no idea how to link it to the spec table. I don't think I want to do this for 150 phases.
__________________________________________
Private Sub TimeStatus_Enter()
If (Phase = "07") And (Me![Time1] < 2 Or Me![Time1] > 5) And (Me![Time2] < 2 Or Me![Time2] > 5) And (Me![Time3] < 2 Or Me![Time3] > 5) And (Me![Time4] < 2 Or Me![Time4] > 5) Then
MsgBox "At lease one test value is out of spec. Test has failed.", vbExclamation, "Test Failed!"
Me!TimeStatus = "failed"
ElseIf (Phase = "08") And (Me![Time1] < 3 Or Me![Time1] > 6) And (Me![Time2] < 3 Or Me![Time2] > 6) And (Me![Time3] < 3 Or Me![Time3] > 6) And (Me![Time4] < 3 Or Me![Time4] > 6) Then
MsgBox "At lease one test value is out of spec. Test has failed.", vbExclamation, "Test Failed!"
Me!TimeStatus = "failed"
Else
Me!TimeStatus = "passed"
End If
End Sub
________________________________________
Thanks in advance for the help