Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using two datacombo 1

Status
Not open for further replies.

mansukh20

Programmer
Mar 11, 2004
14
0
0
GB
Hi guys i have this code:

Private Sub DataCombo2_Change()
Dim sql As String
sql = "select * from creditcard where CUSTOMERID = '" & DataCombo2.Text & "'"
Set RS = New ADODB.Recordset
RS.Open sql, CON

DataCombo3.ListField = RS2!creditcardnum

When the customerID is selected from datacombo2, i want the second datacombo to populate all the credit card numbers of that customer. Currently its producing an error. Any suggestions
 
use a data component
populate the recordset to this data component, select the dbcombo and set the recordsource to this data1 (component)
type the field to be displayed in the combo
do all this in your design

at run time change the recordset for that data component (data1).

Private Sub DataCombo2_Change()
sql = "select * from creditcard where CUSTOMERID = '" & DataCombo2.Text & "

Set Data1.Recordset = dbAccess.OpenRecordset(sql)
end sub

since your dbcombo3 is set to data1 your dbcombo3 will get these values
 
I cannot use the data component instead im using adodc component. I tried adapting the code above but doesnt seem to do the magic?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top