-
Hey guys I have another table question. I am working on a project that involves a user selecting the make and model of a car. I was wondering if anyone had any tables with those listings or actually any code that gives you only the models of the make that is selected. It would be awesome to get. Thanks.
-
Try this
In answer to your first question, you can find just about all makes and models of cars at the Kelley Blue Book site. That site is for pricing new and used cars, and you can go to one page that lists all the makes, then click on a make and get a list of the models. The site is at:
http://www.kbb.com/
For your second question, here is a sample program that fills one combo box with makes on the form load event, and the second combo box with models on the click event of the first combo.
To try it out, drop two combo boxes on a form and set the sorted property to TRUE for both of them (this just alphebatizes the list). Then paste the following code into the form's code window and run the project. When you select a make from the first combo, only that make's models show up in the second combo.
Code:
Option Explicit
'Note: for a good site to get all makes and models of cars, try
'the Kelley Blue Book car pricing web site at: http://www.kbb.com/
Private Sub Form_Load()
'Note: at design time I set the Sorted property to TRUE for
'both combo boxes so they list items alphabetically.
With Combo1
.AddItem "Ford"
.AddItem "Chevy"
.AddItem "Toyota"
.AddItem "Honda"
.AddItem "BMW"
.ListIndex = 0 'Select first item in list as default
End With
End Sub
Private Sub Combo1_Click()
With Combo2
.Clear
Select Case Combo1
Case "Ford"
.AddItem "Mustang"
.AddItem "Thunderbird"
.AddItem "Ranger"
Case "Chevy"
.AddItem "Camaro"
.AddItem "Corvette"
.AddItem "Blazer"
Case "Toyota"
.AddItem "Camry"
.AddItem "Tercel"
.AddItem "FourRunner"
Case "Honda"
.AddItem "Accord"
.AddItem "Civic"
.AddItem "CRX"
Case "BMW"
.AddItem "323i"
.AddItem "528i"
.AddItem "Z3"
End Select
.ListIndex = 0 'Select first item in list as default
End With
End Sub
Edited by seaweed on 03-15-2000 at 03:46 PM