Question : Feed combobox VB6

Hello all,

I need to be able to feed 2 combobox but depending on the first combobox, it will filter the second.
For example:

If i select in combobox1 ("ComDateDisponible.text") the text : August 10, 2010, it will filter all row in my access db that have the same text in column "Période" , and feed combobox2 ("Des_prod.Text") with the text in column "Description_du_produit" of the same row.

How can i do this please?

Thanks for your help.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
'Date available
Dim sSQL3 As String
  Dim oConnect3 As ADODB.Connection
  Set oConnect3 = New ADODB.Connection
  Dim oRST3 As ADODB.Recordset
  Set oRST3 = New ADODB.Recordset


sSQL3 = "SELECT DISTINCT[Période]FROM [Inventaire]'"

oConnect3.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Form4.txtBaseDe.Text

ComDateDisponible.AddItem ""
oRST3.Open sSQL3, oConnect3
Do Until oRST3.EOF
  ComDateDisponible.AddItem oRST3("Période")
  oRST3.MoveNext
Loop

Answer : Feed combobox VB6

We don't have the full picture, but I think you need something like this?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Sub ComDateDisponible_Click()
Dim sSQL3 As String
  Dim oConnect3 As ADODB.Connection
  Set oConnect3 = New ADODB.Connection
  Dim oRST3 As ADODB.Recordset
  Set oRST3 = New ADODB.Recordset


sSQL3 = "SELECT Description_du_produit  FROM [Inventaire] where Periode = " & CDate(ComDateDisponible.Text)

oConnect3.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Form4.txtBaseDe.Text

Des_prod.Clear
oRST3.Open sSQL3, oConnect3
Do Until oRST3.EOF
 Des_prod.AddItem oRST3("Description_du_produit")
  oRST3.MoveNext
Loop

End Sub
Random Solutions  
 
programming4us programming4us