F
Frank Stone
here is a sub i used to auto fill 2 other text boxes when
some enter a PO in the PO txtbox. has quallifiers too.
Maybe you can use it as a template or maybe get some ideas.
delete all of my field names and tables and add in yours.
It uses the dLookup function. syntax:
dlookup("[field1]","table","[field2]='" & me.control & "'"
Private Sub txtPOonPackSlip_BeforeUpdate(Cancel As Integer)
Dim txtPOonPackSlip As Variant
If (IsNull(DLookup
("[POI_Reference]", "POI", "[POI_PurchOrderID]='" & Me!
txtPOonPackSlip & "' and [POI_Reference] = '" & Me!
txtItemID & "'"))) Then
MsgBox ("The ItemID entered is not on the PO
entered. Check your Input.")
Exit Sub
Else
Me!txtVendorName = DLookup
("[POM_PayName]", "POM", "[POM_PurchOrderID] ='" & Me!
txtPOonPackSlip & "'")
Me!txtBuyer = DLookup
("[POM_Buyer]", "POM", "[POM_PurchOrderID] = '" & Me!
txtPOonPackSlip & "'")
End If
End Sub
some enter a PO in the PO txtbox. has quallifiers too.
Maybe you can use it as a template or maybe get some ideas.
delete all of my field names and tables and add in yours.
It uses the dLookup function. syntax:
dlookup("[field1]","table","[field2]='" & me.control & "'"
Private Sub txtPOonPackSlip_BeforeUpdate(Cancel As Integer)
Dim txtPOonPackSlip As Variant
If (IsNull(DLookup
("[POI_Reference]", "POI", "[POI_PurchOrderID]='" & Me!
txtPOonPackSlip & "' and [POI_Reference] = '" & Me!
txtItemID & "'"))) Then
MsgBox ("The ItemID entered is not on the PO
entered. Check your Input.")
Exit Sub
Else
Me!txtVendorName = DLookup
("[POM_PayName]", "POM", "[POM_PurchOrderID] ='" & Me!
txtPOonPackSlip & "'")
Me!txtBuyer = DLookup
("[POM_Buyer]", "POM", "[POM_PurchOrderID] = '" & Me!
txtPOonPackSlip & "'")
End If
End Sub