Results 1 to 9 of 9

Thread: Calling out values entered into Combo Box

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    10

    Resolved 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:
    1. Select Case Classification.Car_Make.Value
    2.     Case "Acura"
    3.         Car = 1
    4.         Class_Results.Make_Text_Box.Caption = "Acura"
    5.     Case "Audi"
    6.         Car = 2
    7.         Class_Results.Make_Text_Box.Caption = "Audi"
    8.     Case Else
    9.         Bead = 0                                
    10. End Select
    11.    
    12. If Car = 1 Then
    13.     Classification.Car_Model.AddItem "CL", 0
    14.     Classification.Car_Model.AddItem "Integra", 1
    15.     Classification.Car_Model.AddItem "Integra Type R", 2
    16.     Classification.Car_Model.AddItem "Legend", 3
    17.     Classification.Car_Model.AddItem "NSX", 4
    18.     Classification.Car_Model.AddItem "RL", 5
    19.     Classification.Car_Model.AddItem "RSX", 6
    20.     Classification.Car_Model.AddItem "RSX Type S", 7
    21.     Classification.Car_Model.AddItem "TL", 8
    22.     Classification.Car_Model.AddItem "TSX", 9
    23.     Classification.Car_Model.AddItem "Vigor", 10
    24.     Class_Results.Model_Text_Box.Caption = Classification.Car_Model.Value
    25. 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?
    Last edited by DSPDA3; Jun 22nd, 2005 at 10:09 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    10

    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.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    10

    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?

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    10

    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?

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    10

    Re: Calling out values entered into Combo Box

    I fixed it. Thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width