i have connected combo box with data base...
i have called a field in combo box...
but i dont know how to made selection..
means when i click on items that are in combo box from database, the text box should change value according to the selection of combobox.
Option Explicit Private con As New ADODB.Connection Public rs As New ADODB.Recordset Private Sub Form_Activate() Dim con As New ADODB.Connection con.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ISIS_157;Data Source=JASEEMAHMED" con.Open Set rs = New ADODB.Recordset rs.Open "SELECT * from EQUIPMENT", con, adOpenStatic, adLockOptimistic Do While Not rs.EOF = True Combo1.AddItem rs.Fields("Itemcode") Text1.Text = rs!Description rs.MoveNext Loop End Sub
i have 2 fields in database, one is item code, other is description, now i have 10 item codes and its description.
i want to show item code in combo box, and its discription in text box.
when combobox value changes, the text box should also change its description, acording to the itemcode, which is saved in database.