Fill Combo List using Criteria selected in another Combo List 
Author Message
 Fill Combo List using Criteria selected in another Combo List

I have 2 (data) Combo Boxes on a VB6. One lists computer component
categories ie Hard Drives, Motherboards, Monitors etc

The other lists the make/model of the components ie Western Digital 10gb
Hard drive.

They are both part of an MS Access(97) Database Table.

What I want to do is have the second one's list limited by the category
selected in the first. ie if the Hard Drive category is selected in the
first, ONLY Hard Drives are listed in the second.

How can this be achieved??

I also want to update a Text Box with the price once the 2 have been
selected, so any help with these would be VERY much appreciated.

Cheers



Fri, 05 Dec 2003 18:49:30 GMT  
 Fill Combo List using Criteria selected in another Combo List
'These codes are taken from my current project for a Computer
Reseller/Assembler which, I believe, closely resembles to what you're
trying to do.
'About the UPDATE, well, that's another story...er...subProcedure.
'rsPart recordset declaration can be included inside the subProcedure or,
as in my case, in a separate module.

Public Sub qMaker() 'procedure to populate PART ComboBox
Dim strMaker As String
On Error Resume Next
    strMaker = "Select DISTINCT Part_description from Part "
    Set rsPart = dbConn.Execute(strMaker)
    rsPart.MoveFirst
    cboQPartName.Clear
    Do Until rsPart.EOF
        cboQPartName.AddItem rsPart!Part_description
        rsPart.MoveNext
    Loop
End Sub

'*** When you select from the COMBOBOX, it will execute the ff. code ***

Private Sub cboQMaker_Click() 'procedure to populate PART TYPE ComboBox
Dim strType As String
On Error Resume Next
strType = "Select DISTINCT Part_type from Part where Part_description = " _
              & "'" & cboQPartName.Text & "'"
    Set rsPart = dbConn.Execute(strType)
    rsPart.MoveFirst
    cboQPartType.Clear
    Do Until rsPart.EOF
        cboQPartType.AddItem rsPart!Part_Type
        rsPart.MoveNext
    Loop
End Sub

Quote:

> I have 2 (data) Combo Boxes on a VB6. One lists computer component
> categories ie Hard Drives, Motherboards, Monitors etc

> The other lists the make/model of the components ie Western Digital 10gb
> Hard drive.

> They are both part of an MS Access(97) Database Table.

> What I want to do is have the second one's list limited by the category
> selected in the first. ie if the Hard Drive category is selected in the
> first, ONLY Hard Drives are listed in the second.

> How can this be achieved??

> I also want to update a Text Box with the price once the 2 have been
> selected, so any help with these would be VERY much appreciated.

> Cheers

--
Posted via CNET Help.com
http://www.help.com/


Sat, 06 Dec 2003 06:30:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Fill Combo List using Criteria selected in another Combo List

2. Rebuild select list for combo/list box

3. Updating a combo box list W/limit to list selected

4. Arrays for filling Combo's and Lists ?

5. Speed - Filling many huge combo list boxes

6. Filling a combo list with table names

7. Filling a combo box with a list of files in a direcotry at run time

8. Combo date value set by code gets ignored by combo's list when opened

9. One-Click / Mouse-over on Combo List - subclass combo question

10. Help: One-Click / Mouse-over on Combo List - subclass combo question

11. Listing all tables or queries in a list/combo box

12. How to list macro names in a combo box or a list box

 

 
Powered by phpBB® Forum Software