มันประมาณนี้ครับ
Dim ProD As String
Dim CusID As String
If Not IsNull(Me.Prod_ID) Then
ProD = Me.Prod_ID
CusID = Forms!frmpos.Form.cus_id
If IsNull(DLookup("deal_price", "tblDeal", "[cus_id]= " & CusID & " And [pord_id]= " & [ProD] & "")) Then
Me.Price = DLookup("pord_price", "tblProduct", "product_id= " & ProD)
Else
Me.Price = DLookup("deal_price", "tblDeal", "[cus_id]= " & CusID & " And [pord_id]= " & [ProD] & "")
End If
End If
ตัวอย่าง คร่าวๆ ครับเผื่อเห็นแนวทาง