I'm trying to display the Vendor Name and a message that a selected PO Number (from a combo box on the form) does not require QA in a message box. The DLookup to get the vendor number from the PO Number works, but I can't seem to nest it to get the Vendor Name string from a separate table. What am I missing in this nested DLookup?
PO Number, Vendor Number, and Vendor Name are all strings.
Private Sub VendorName_AfterUpdate()
Debug.Print Me.VendorName.Value
If DCount("*", "ZeroAudit", "PONumber='" & Me.PONumber & "' and VendorName='" & Me.VendorName & "'") = 0 Then
MsgBox "Needs QA"
Else
MsgBox "Vendor " & DLookup("Vendor", "Vendors", "VendorNumber = " & (DLookUp("VendorNumber","POHeader","PONumber= [Forms]!QAChecker2!PONumber.Value"))) & " — Does NOT Need QA — DIM and RETAIL CHECK REQUIRED"
End If
Me.PONumber.SetFocus
End Sub