Look for a value in a table

B

bicyclops

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
 
K

Ken Snell [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top