Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Vendor POC combo box based on the selected Vendor

Status
Not open for further replies.
Oct 24, 2002
512
US
I have a purchase order (frmPO) that has a combo box (cboVendor) to select a vendor. Once the vendor is selected, the various address lines are automatically populated.

Below this, I have a combo box (cboPOC) to select the vendor point of contact. Right now, the box displays all POCs in the underlying table. I'd like the combo box to display only those POCs that relate to the vendor that the user selected.

Is this easy? Am I overlooking something simple? Any help will be enormously appreciated.

Ann
 
Yes.

ComboBox has a filter property. Set this property to "[VendorID] = [form]![frmPO].[cboVendor]"

I think the syntax is correct.
 
Okay, so maybe I'm brain dead. Where would I place this line of code?

Ann
 
Select the outer edge of the sub-form and then select propreties. there will be a properties box in the properties window labled "Link On" or "Linked field", i dont remember, not on a machine with access, but it is easily identifiable.
 
Yes, I knew I could link fields between main/sub forms. However, my POC field is a field on the main form as are the vendor fields on the main form.

Other ideas? If there's no other way to do it, I guess I will create a subform for the POC.

Ann
 
After changing the combo box Row Source (i.e., adding a WHERE clause) it filters the way I want:

SELECT [qryVendorPOCs].[POCID], [qryVendorPOCs].[POCName], [qryVendorPOCs].[POCPhone], [qryVendorPOCs].[VendorID] FROM qryVendorPOCs WHERE [qryVendorPOCs].[VendorID]=[forms]![frmPO].[VendorID] ORDER BY [qryVendorPOCs].[POCName];

Ann
 
Ann

I have the same problem and it sounds like you have solved yours by adding the WHERE clause. It works partly for me. I get the right "filter" but alwas the POC's related to the first vendor. So if I choose another vendor my form doesnt seem to be updated. Any suggestions?

Brian
 
Hi Brian. Sorry for the delay; I've been out of pocket for a few days.

Try putting this into the OnCurrent event of your form:

Me.NameOfYourPOCComboBox.Requery

Hopefully, you'll get the same results I do.

Ann
 
Hi Ann

It dit'nt work exactly the same way, because I have the combobox on the same form. But if I put the Me.combobox.Request on the Combobox's own property under "On got focus" it works perfectly.

You've earned a star for this
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top