I have two comboboxes the first one is for order #, the second one is for the amount of order payments, there could be 1, 2, 3... payments for this order. I would like to get all payments to show in the second combobox that relate to the order # selected in the first, process that payment by changing other values in other textbox's. Then have that payment psoted as processed back to the DB table. I have a binding satament, but it pulls all payments, and not just per order. How can I get this to select just by order #?

>How can I get this to select just by order #?

If your code uses DataTable then use Select() method or DataView to filter.

Otherwise, you can simply put where clause with select statement in command object to fetch rows.

>How can I get this to select just by order #?

If your code uses DataTable then use Select() method or DataView to filter.

Otherwise, you can simply put where clause with select statement in command object to fetch rows.

Here is the sub that is called on selected index chnage for the combobox:

Private Sub CKAmt_process()
Dim CKAmtSource As String
sProcess = "No"
CKAmtSource = "SELECT Ck_Amt FROM Customer_Pmt"
'CKAmtSource = CKAmtSource + " WHERE (Job_Number = '" & Me.tb_Job_No.Text & "') "
CKAmtSource = CKAmtSource + " AND (Process = '" & sProcess & "') "

'Dim Main_Form As New Main_Form
With Main_Form
.DC_Reps.Open()
.DS_CustPmt1.Clear()
.DA_CustPmt.SelectCommand.CommandText = CKAmtSource
.DA_CustPmt.Fill(.DS_CustPmt1)

Me.TB_Ck_Amt.Items.Clear()

If .DS_CustPmt1.Customer_Pmt.Rows.Count <> 0 Then

X = 0
Do
Me.TB_Ck_Amt.Items.Insert(X, .DS_CustPmt1.Customer_Pmt(X + 1).Ck_Amt.ToString)

X += 1
Loop Until X = .DS_CustPmt1.Customer_Pmt.Rows.Count - 1

End If
Me.TB_Ck_Amt.Text = Me.TB_Ck_Amt.Items.Item(0).ToString()

End With
End Sub
I get all payments not just the ones for an order.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.