cascading list boxes for query

  • Thread starter Thread starter Robert Painter
  • Start date Start date
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
 
Thanx for the assistance. Have managed to now get it working correctly..
once again thankyou

Robert
 
Back
Top