Combo and List boxes filter

  • Thread starter Thread starter accessuser via AccessMonster.com
  • Start date Start date
A

accessuser via AccessMonster.com

Hi,

I'm creating a Vendor/Product database and want users to select the vendor
from the Combo Box (CboVendor), and then the List box (LstProduct) will
display all products that particular vendor has.


CboVendor

SELECT QryVendorForCombo.CompanyName, QryVendorForCombo.VedorID FROM
QryVendorForCombo ORDER BY [CompanyName];

LstProducts

SELECT QryVendorProduct.ProductID, QryVendorProduct.ProductName,
QryVendorProduct.Rating, QryVendorProduct.VendorID FROM QryVendorProduct;


The following is the code I used, but it is not working, i wont display
products on the list box:

Private Sub CboVendor_Change()
Dim SQL As String

SQL = "Select * lstproducts Where vendor_id=" & Me.CboVendor.Value

Me.lstProducts.RowSource = SQL
Me.lstProducts.Requery

End Sub

Can someone please help me on this. I research for couple days now and can't
seem to find anything.

Thanks in advance!
 
You are referenceing the Combo Box Bound Column wrong.


Instead of Me.CboVendor.Value

It should be Me.CboVendor.Column(0)
 
Back
Top