DBCombo box to fill a DBGrid
Posted on 1998-03-23
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 firstname.lastname@example.org