Combo and List boxes filter

  • Thread starter accessuser via AccessMonster.com
  • 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!
 
R

Ruel Cespedes via AccessMonster.com

You are referenceing the Combo Box Bound Column wrong.


Instead of Me.CboVendor.Value

It should be Me.CboVendor.Column(0)
 

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