Field Problem

C

Chris

I have a form that I am using for receiving in Purchase
Orders. When the user types in the PO# I would like the
Vendor Name to be pulled from a different table and appear
on a field in my form. How can I do this?
 
P

PC Datesheet

Chris,

Put this code in the AfterUpdate event of the PO# textbox:

Me!NameOfVendorTextBox =
DLookup("VendorName","QryVendorNameForPOReceiving","[POID] = " & Me!POID)

Where QryVendorNameForPOReceiving is a query joining TblVendor and TblPO.
 
J

John Vinson

I have a form that I am using for receiving in Purchase
Orders. When the user types in the PO# I would like the
Vendor Name to be pulled from a different table and appear
on a field in my form. How can I do this?

One way to do this would be to set the Control Source of a textbox to
an expression like

=DLookUp("[Vendor Name]", "[qryPOVendor]", "[PO#] = " & Me![txtPO#])

This assumes that you have a Query named qryPOVendor linking the two
tables, that your form textbox containing the PO number is named
txtPO#, and that PO# is a Number type; if it's Text, use

"[PO#] = '" & Me![txtPO#] & "'"
 

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