Calling out values entered into Combo Box
I'm having some issues returning a value from a combo box. Acura, Audi, etc. are added to a combo box in the Load_Menu code, and are taken care of when I load the program. Based on what's chosen in the first combo box, the next combo box is populated as a result. I've shown the first choice simply to save space...
-------------------------------------------------
VB Code:
Select Case Classification.Car_Make.Value
Case "Acura"
Car = 1
Class_Results.Make_Text_Box.Caption = "Acura"
Case "Audi"
Car = 2
Class_Results.Make_Text_Box.Caption = "Audi"
Case Else
Bead = 0
End Select
If Car = 1 Then
Classification.Car_Model.AddItem "CL", 0
Classification.Car_Model.AddItem "Integra", 1
Classification.Car_Model.AddItem "Integra Type R", 2
Classification.Car_Model.AddItem "Legend", 3
Classification.Car_Model.AddItem "NSX", 4
Classification.Car_Model.AddItem "RL", 5
Classification.Car_Model.AddItem "RSX", 6
Classification.Car_Model.AddItem "RSX Type S", 7
Classification.Car_Model.AddItem "TL", 8
Classification.Car_Model.AddItem "TSX", 9
Classification.Car_Model.AddItem "Vigor", 10
Class_Results.Model_Text_Box.Caption = Classification.Car_Model.Value
End If
-----------------------------------------
When I select 'Acura', it pops up with list of models shown above. I then select 'Integra', but it doesn't return that value. Thoughts?
Re: Calling out values entered into Combo Box
Are you using VBA in an Office app or just VB6?
What do you mean it doesnt return that value?
I take it Classification is a Form.
Re: Calling out values entered into Combo Box
Using VBA via Excel.
Yes, Classification is the name of a form. I'd like to run it as a stand-alone program, but have never dealt with VB6. How complicated would this be?
As far as not returning the value, I have two forms set up. One to enter the info, as shown above, and the second to return the info that was entered, along with some info that is determined using the input data. When I input 'Acura', it returns to the appropriate field in the second form. However, when I input 'Integra', nothing is returned.
Re: Calling out values entered into Combo Box
You cant have a standalone program that relies upon Excel unless you assume that the user will have Excel installed.
In your select case statement you do not have the case for Integra listed.
Re: Calling out values entered into Combo Box
Integra is not within the Select Case structure. When I select Acura, it displays all the models that fall under Acura, or when Car = 1, according to the code. When 'Integra' is selected in the combo box, I would like the program to return 'Integra', or whatever is selected within the combo box.
Should I have 2 seperate Select Case structures?
Re: Calling out values entered into Combo Box
The code you posted is under the Car_Make combo box click event?
What event is, if any, the Car_Model code in and can you post it?
Re: Calling out values entered into Combo Box
The code above is under the Car_Make combo box click event. Actually, all of it was. I seperated the Car_Model stuff into a Car_Model combo box click event, and all is well now.
However I have a new problem. :) I have the second form set up to go back to the original input form, to enter new data, but it's not clearing the original input values. How do I do this?
Re: Calling out values entered into Combo Box
You have to loop through your controls setting their .Text property to vbNullString or .SelectedIndex = -1 where appropriate.
Re: Calling out values entered into Combo Box
I fixed it. Thanks for the help.