Restricting the content of a listbox by choosing a item in a combobox

odrap

Registered User.
Local time
Today, 12:12
Joined
Dec 16, 2008
Messages
156
In a form "frmAankoopArtikelen" i have a combobox ' cboLev' to let the user choose a delivery agent. After making a selection, the value of "LEVID" is stored in the textbox "LevID"
On the same form i have a listbox "lstAvailableItems" with a recordsource based on the following query.

SELECT tblArtikelen.LevID, tblArtikelen.Artnr, tblArtikelen.Levcode, tblArtikelen.Omschrijving, tblArtikelen.Voorraad, tblArtikelen.Bestelpunt, tblArtikelen.Inbestelling, tblArtikelen.Besteldatum, VERKOPEN2008.TotaalVerkocht AS [Uit VJ], Verkopen2009.TotaalVerkocht AS [Uit Nu]
FROM ((tblArtikelen INNER JOIN VERKOPEN2008 ON tblArtikelen.Artnr=VERKOPEN2008.Artnr) INNER JOIN Verkopen2009 ON tblArtikelen.Artnr=Verkopen2009.Artnr) INNER JOIN tblLeveranciers ON tblArtikelen.LevID=tblLeveranciers.LevID
WHERE (((tblArtikelen.LevID)=[Forms]![frmAankoopArtikelen]![LevID]))
ORDER BY tblArtikelen.Artnr;

I hoped to get it done this way to see the listbox populating only with the data of the articles that only the choosen delivery agent delivers. But i get no result. What's wrong with this code?
 
The concept you describe is generally called cascading combos (in this regard, a listbox is no different than a combo). Some methods here:

http://www.baldyweb.com/CascadingCombo.htm

From the look of it, you may not be correctly referencing the name of the combo, and perhaps you need a requery in the after update event of the combo.
 
Thank you very much for the help
 

Users who are viewing this thread

Back
Top Bottom