Look for a value in a table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anyone know how to do the following?

Create a macro (or if not VB code) to look at a table (TblAssyShipments) and
find out if any record exists that has a value in the field OrderDetailID
that is equal to the value of OrderDetailID in a control on the current form.
If so, a True/False field is set to True.

Thanks
 
Use the DLookup function to get the value from the table, and then compare
it to the form's control's value, and then display a message if it matches.

Condition: IsNull(DLookup("OrderDetailID", "TblAssyShipments",
"OrderDetailID=" & Forms!FormName!ControlName)) = False
Action: MsgBox
Message: This value exists
 
Back
Top