ADO and Bound Data Combo Control Question - NEWBIE 
Author Message
 ADO and Bound Data Combo Control Question - NEWBIE

Hi all...

I am doing a DB application using MS-Access 2000. I have a form in which I have 2 data combo controls. The first is querying a table and getting results back to populate the combo box. I need the second one to be populated based upon the choice that the user selects from the first one. Is there any way to do this? The query to populate the 2nd combo box will need a value supplied from the first. (Essentially doing lookups, you know, like if state selected is CA, then list only the CA Zip codes in the 2nd combo).

Each control pulls values from separate tables, so there is no exact same field being used. I have a foreign key linking the tables, so the 1st combo box selection can provide that the the query for the 2nd box. I have Querys set up in Access to accomplish this, but am lost trying to get it done in VB 6.

Any help is GREATLY appreciated!!!

Scott



Fri, 24 Dec 2004 00:06:24 GMT
 ADO and Bound Data Combo Control Question - NEWBIE

In the AfterUpdate or Click event of combo1, set the .RowSource of combo2:

Dim strSQL As String

strSQL = "SELECT * FROM tblZipCodes WHERE lngStateID=" & Me.Combo1.Column(0)

Me.combo2.RowSource = strSQL

Of course, you'll have to change the names to match those on your
form/tables.

Scott McDaniel
CS Computer Software
Always looking for contract work ...


Hi all...

I am doing a DB application using MS-Access 2000. I have a form in which I
have 2 data combo controls. The first is querying a table and getting
results back to populate the combo box. I need the second one to be
populated based upon the choice that the user selects from the first one. Is
there any way to do this? The query to populate the 2nd combo box will need
a value supplied from the first. (Essentially doing lookups, you know, like
if state selected is CA, then list only the CA Zip codes in the 2nd combo).

Each control pulls values from separate tables, so there is no exact same
field being used. I have a foreign key linking the tables, so the 1st combo
box selection can provide that the the query for the 2nd box. I have Querys
set up in Access to accomplish this, but am lost trying to get it done in VB
6.

Any help is GREATLY appreciated!!!

Scott



Fri, 24 Dec 2004 02:55:54 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie Question: Bound Data Controls with SQL Server 7.0

2. How to bind ADO data bound controls in Visual C++

3. ADO Data Control and Bound Controls

4. Combo Box Within A Data Bound Grid Control

5. Bind an ado recordset directly to an ado data control (adodc)

6. ADO Data control bind to ADO DataGrid

7. First Cell Empty in Data Grid bound to ADO Data Control

8. Newbie Question: ADO Data Control standard properties

9. Data-Bound Vs. Non-Data-Bound Controls

10. (newbie) ADO bound controls not refreshing


 
Powered by phpBB® Forum Software