cascading list boxes for query

R

Robert Painter

Hi
have grabbed code for cascading list/cbo boxes and adapted to hopefully
suit.
lstCategory from tblcategories.categorydescription
lstSkill from tblskill.skilldescription

using the following code:

Private Sub lstCategory_AfterUpdate()
Dim strCateg As String
Dim varSelected As Variant

If Me.lstCategory.ItemsSelected.Count > 0 Then
For Each varSelected In Me.lstCategory.ItemsSelected
strCateg = strCateg & "'" & Me.lstCategory.ItemData(varSelected) & "',
"
Next varSelected
strCateg = Left(strCateg, Len(strCateg) - 2)
Me.LstSkill.RowSource = "SELECT SkillDescription " & _
"FROM tblSkills " & _
"WHERE tblCategory IN (" & strCateg & ") " & _
"ORDER BY SkillDescription"
End If

I cannot get rowsource populated hence nothing showing in lstSkill

Any ideas of what i am doing wrong.

Have managed to cascade but done another way but lst only refreshes when
focused.

Robert
 
R

Robert Painter

Thanx for the assistance. Have managed to now get it working correctly..
once again thankyou

Robert
 

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

Similar Threads


Top