我正在尝试在消息框中显示供应商名称和选定的采购订单号(来自表单上的组合框)不需要 QA 的消息。从采购订单编号获取供应商编号的 DLookup 有效,但我似乎无法嵌套它以从单独的表中获取供应商名称字符串。我在这个嵌套的 DLookup 中缺少什么?
PO Number、Vendor Number 和 Vendor Name 都是字符串。
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