Here's my code:
Quote:
Private Sub cboSKP_Click()
Dim rs6 As New ADODB.Recordset
With rs6
.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & NmDatabase & ";Persist Security Info=False"
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.Source = "SELECT * FROM Products WHERE NoProd = '" & cboProd.Text & "'"
.Open
If cboProd.ListIndex > -1 Then
cboCust.Text = rs6(3)
Dim rs8 As New ADODB.Recordset
With rs8
.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & NmDatabase & ";Persist Security Info=False"
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.Source = "SELECT * FROM Ms_Cust WHERE Code = '" & cboCust.Text & "'"
.Open
If cboCust.Text = rs6(3) Then
lblSalesMan.Caption = rs8(8)
lblCompName.Caption = rs8(1)
lblAdd.Caption = rs8(2)
End If
cboTerm.Text = rs6(4)
txtDue.Text = rs6(5)
End With
If cboProd.Text = rs6(0) Then
rs(0).Value = rs6(6)
rs(2).Value = rs6(7)
End If
End If
.Close
End With
End Sub
I'm using VB6, ADODB, and MsAccess as for the database.
Using the combobox as the key to display all of records from the table.
For NoProd = Prod001 has 3 records : candybar, chocolate, sweets
When i change the combobox of NoProd to Prod001,
But why my datagrid show only candybar?