Hello
I have the following code
I am getting runtime error 2465 "Access cannot find the field TestName in your expression". I believe this is because TestName is in a subform of QC2EntryForm because the Product Code criteria is returning the proper value. How do I refer to a subform properly?
I have the following code
Code:
Option Compare Database
Private Sub TestResult_BeforeUpdate(Cancel As Integer)
If Me.TestResult < DLookup("MinValue", "QCSpecs", "criteria1='" & Forms!QC2EntryForm!ProductCode _
& "and criteria2 = '" & Forms!QC2EntryForm!TestName & "'") And Me.TestResult > _
DLookup("MaxValue", "QCSpecs", "criteria1='" & Forms!QC2EntryForm!ProductCode _
& "and criteria2 = '" & Forms!QC2EntryForm!TestName & "'") Then
MsgBox ("Out of Spec")
Cancel = True
End If
End Sub
I am getting runtime error 2465 "Access cannot find the field TestName in your expression". I believe this is because TestName is in a subform of QC2EntryForm because the Product Code criteria is returning the proper value. How do I refer to a subform properly?