Query based of a value in a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The application I'm working on has three tables State, Customer, Orders. In
the first combo box the State is selected. Based on the State selected the
second combo box will be populated with the Customers in that state. Based
on the Customer selected a datagrid will be populated with the customer's
orders.

I setup the query for the secont combo box as follows:
Select CustName From tblCustomer
Where State = @cboState

When I run this no records are selected. Any suggestions on what I am
missing or forgetting? Thanks...
 
Hi,

I would check that you are passing the right value to your query.
If your combobox is bound to a datatable the selected item will be a
datarowview not the string shown in the combobox.

Ken
 
Ken,

The combo box is configured as follows:

Name: cmbCustName
DataSource: TblCustomerBindingSource1
DisplayMember: CustName
VauleMember: CustName
SelectedItem: TblCustomerBindingSource1 - CustName

I declared a variable - Dim varCustNmae as String

After the State combo box is changed I have teh following code:
varCustName = cboState.SelectedValue
 
Back
Top