N
NEWER USER
I am having trouble getting the entry in the field to Select itself.
SelectMake is a check box
lstType is a Multi List Box
When I select "Asian" in the List Box and check the Check Box, all the Asian
vehicles are selected except "Acura". It is displayed, but I must manually
hold down the Ctrl key and select. I played with the sorting from ascending
to descending and it worked, but then "Yugo" in Eurpoean (which is now first
in the list) will not select. Any help on why the first record will not
select is 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) = "European" Then
SetSelections Me.lstMake, 0, "Alfa Romeo", "Audi", "Austin",
"Bentley", "Bertone", "BMW", "Ferrari", _
"Fiat", "Jaguar", "Land Rover", "Lotus", "Maserati", "Maybach",
"Mercedes Benz", "MG", "Merkur", "Mini", "Opel", "Peugeot", _
"Porsche", "Renault", "Rolls Royce", "Rover", "Saab", "Smart",
"Triumph", "Volvo", "Volkswagen", "Yugo"
End If
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 = -1 And Me.lstType.Column(1) = "Domestic" Then
SetSelections Me.lstMake, 0, "AM General", "American Motors",
"Buick", "Cadillac", "Checker", _
"Chevrolet", "Chrysler", "DeLorean", "Dodge", "Eagle", "Ford",
"Freightliner", "GMC", "Hummer", _
"International", "Jeep", "Lincoln", "Mercury", "Oldsmobile",
"Plymouth", "Pontiac", "Saturn", _
"Shelby"
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
SelectMake is a check box
lstType is a Multi List Box
When I select "Asian" in the List Box and check the Check Box, all the Asian
vehicles are selected except "Acura". It is displayed, but I must manually
hold down the Ctrl key and select. I played with the sorting from ascending
to descending and it worked, but then "Yugo" in Eurpoean (which is now first
in the list) will not select. Any help on why the first record will not
select is 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) = "European" Then
SetSelections Me.lstMake, 0, "Alfa Romeo", "Audi", "Austin",
"Bentley", "Bertone", "BMW", "Ferrari", _
"Fiat", "Jaguar", "Land Rover", "Lotus", "Maserati", "Maybach",
"Mercedes Benz", "MG", "Merkur", "Mini", "Opel", "Peugeot", _
"Porsche", "Renault", "Rolls Royce", "Rover", "Saab", "Smart",
"Triumph", "Volvo", "Volkswagen", "Yugo"
End If
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 = -1 And Me.lstType.Column(1) = "Domestic" Then
SetSelections Me.lstMake, 0, "AM General", "American Motors",
"Buick", "Cadillac", "Checker", _
"Chevrolet", "Chrysler", "DeLorean", "Dodge", "Eagle", "Ford",
"Freightliner", "GMC", "Hummer", _
"International", "Jeep", "Lincoln", "Mercury", "Oldsmobile",
"Plymouth", "Pontiac", "Saturn", _
"Shelby"
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