Combobox to listbox data help

R

ryan.fitzpatrick3

I have a combobox where I want the data from the choice in the
combobox to go to a listbox. Now this works on the first selection,
but when I change back and forth between combobox choices it stays on
the first selection like its locked into place. Essentially how do I
get the listbox to reflect whatever choices I have in the combobox?
Here is my code. The two tables are linked together fine.

ProductName = Item (subclass)
CategoryID = Class of item
Item = combobox name

SELECT DISTINCT Products.ProductName, Products.CategoryID
FROM Products
WHERE (((Products.CategoryID)=[forms]![frmMainForm]![Item]))
ORDER BY Products.ProductName;

ryan

Whats wrong?
 
J

John W. Vinson

I have a combobox where I want the data from the choice in the
combobox to go to a listbox. Now this works on the first selection,
but when I change back and forth between combobox choices it stays on
the first selection like its locked into place. Essentially how do I
get the listbox to reflect whatever choices I have in the combobox?
Here is my code. The two tables are linked together fine.

ProductName = Item (subclass)
CategoryID = Class of item
Item = combobox name

SELECT DISTINCT Products.ProductName, Products.CategoryID
FROM Products
WHERE (((Products.CategoryID)=[forms]![frmMainForm]![Item]))
ORDER BY Products.ProductName;

ryan

Whats wrong?

Requery the listbox in the AfterUpdate event of the combo box.

John W. Vinson [MVP]
 
R

ryan.fitzpatrick3

Thanks, I figured it out right after I posted. :)

I have a combobox where I want the data from the choice in the
combobox to go to a listbox. Now this works on the first selection,
but when I change back and forth between combobox choices it stays on
the first selection like its locked into place. Essentially how do I
get the listbox to reflect whatever choices I have in the combobox?
Here is my code. The two tables are linked together fine.
ProductName = Item (subclass)
CategoryID = Class of item
Item = combobox name
SELECT DISTINCT Products.ProductName, Products.CategoryID
FROM Products
WHERE (((Products.CategoryID)=[forms]![frmMainForm]![Item]))
ORDER BY Products.ProductName;

Whats wrong?

Requery the listbox in the AfterUpdate event of the combo box.

John W. Vinson [MVP]
 

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