I have one combo box “cboitemname” and one text box “itemcode” in vb6 form,I have a table “stock” in sql server 2000 database where data about item name and its code is present, in rutime I want to disply item code of item that I select from combolist, how should I do this?

I think you get idea from it.

As follows -

Set rsItemName = New ADODB.Recordset

    rsItemName.Open "......", cnItemNAme, adOpenStatic, adLockOptimistic 'Where open is your connection string
   
    If rsItemName.BOF = True Then
        Exit Sub
    ElseIf rsItemName.EOF = True Then
        Exit Sub
            Else
    Do While rsItemName.EOF = False
        cmbItemName.AddItem rsItemName("ItemCode") 'ItemCode is the name of your field
      rsItemName.MoveNext
    Loop
 End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.