N
NEWER USER
I am having trouble underrstanding why this code is flawed The first row in
my List Box "Acura" is NOT getting selected... All other rows are selected
and highlighted...WHY? SelectMake is a Check Box; any help appreciated
Private Sub SelectMake_AfterUpdate()
Dim varItem As Variant
Dim strWhere As String
Dim varSelected As Variant
'Select corresponding rows in lstMake List Box; Update lstModel
If Me.SelectMake = -1 And Me.lstType.Column(1) = "Asian" Then
SetSelections Me.lstMake, 0, "Acura", "Asuna", "Daihatsu", "Daewoo",
"Geo", "Honda", "Hyundai", _
"Infiniti", "Isuzu", "Kia", "Lexus", "Mazda", "Mitsubishi",
"Nissan", "Subaru", "Suzuki", "Toyota", _
"Sterling", "Scion"
End If
If Me.SelectMake = 0 Then
For Each varItem In lstMake.ItemsSelected
lstMake.Selected(varItem) = False
Next varItem
End If
If Me!lstMake.ItemsSelected.Count > 0 Then
strWhere = "WHERE [Make] IN ("
For Each varSelected In Me!lstMake.ItemsSelected
strWhere = strWhere & "'" & Me!lstMake.ItemData(varSelected) & "', "
Next varSelected
strWhere = Left(strWhere, Len(strWhere) - 2) & ") "
Me.Controls("lstModel").RowSource = "SELECT DISTINCT " & _
"[Model] FROM [qryModels] " & strWhere & _
"ORDER BY [Model]"
Else
Me!lstModel.RowSource = ""
End If
End Sub
my List Box "Acura" is NOT getting selected... All other rows are selected
and highlighted...WHY? SelectMake is a Check Box; any help appreciated
Private Sub SelectMake_AfterUpdate()
Dim varItem As Variant
Dim strWhere As String
Dim varSelected As Variant
'Select corresponding rows in lstMake List Box; Update lstModel
If Me.SelectMake = -1 And Me.lstType.Column(1) = "Asian" Then
SetSelections Me.lstMake, 0, "Acura", "Asuna", "Daihatsu", "Daewoo",
"Geo", "Honda", "Hyundai", _
"Infiniti", "Isuzu", "Kia", "Lexus", "Mazda", "Mitsubishi",
"Nissan", "Subaru", "Suzuki", "Toyota", _
"Sterling", "Scion"
End If
If Me.SelectMake = 0 Then
For Each varItem In lstMake.ItemsSelected
lstMake.Selected(varItem) = False
Next varItem
End If
If Me!lstMake.ItemsSelected.Count > 0 Then
strWhere = "WHERE [Make] IN ("
For Each varSelected In Me!lstMake.ItemsSelected
strWhere = strWhere & "'" & Me!lstMake.ItemData(varSelected) & "', "
Next varSelected
strWhere = Left(strWhere, Len(strWhere) - 2) & ") "
Me.Controls("lstModel").RowSource = "SELECT DISTINCT " & _
"[Model] FROM [qryModels] " & strWhere & _
"ORDER BY [Model]"
Else
Me!lstModel.RowSource = ""
End If
End Sub