Link to home
Start Free TrialLog in
Avatar of rummy
rummy

asked on

DBCombo box to fill a DBGrid

I’m using two Data Controls, one DBCombo box and a DBGrid on a VB5 form. I want to select an item from DBCombo1 and use that item in an SQL statement to populate Data2 which in turn populates the DBGrid. I’m using the Customers and Orders table from the Nwind.mdb database that comes with VB.

To populate the DBComb1 I’m using the following SQL statement as the Data1 Recorsource

SELECT CustomerId from Customers ORDER BY CustomerId

Then to populate Data2 I’m using this SQL statement

SELECT * from Orders WHERE CustomerID = "DBCombo1.Boundtext"

The DBGrid Datasource is set to Data2

When I run this program the column heads appear as the should but I don’t get any data in the column.
I think the problem in in the SELECT * from Orders WHERE CustomerID = "DBCombo1.Boundtext" statement - specifically in the Boundtext area.

Can anyone help me figure out how to get the columns to fill ?

NOTE: Please e_mail answer to jbennet@home.com

Thanks

ASKER CERTIFIED SOLUTION
Avatar of Dalin
Dalin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dalin
Dalin

Rummy,
If you encounter an error of too few parameter, put your SQL statements:
SQL = "SELECT * FROM Orders WHERE [CustomerID] = '" & DBCombo1.Text & "'")

Regards