Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Posts
    1

    Unanswered: adodc and combo boxes problems

    Hello,

    I've been working with VB6 and ADO objects for a while. But there are a few small problems that i still haven't been able to solve.

    I've got an adodc controller, textbox and an ADO combobox.

    All i want to do is to scroll the combobox and select an item(itemNo) and the related info(ItemDesc) should appear in the textbox.

    The problem i've got is that nothing happends with the textbox when I select something from the combo box. However, if i use the scroll buttons on the ADODC controller it updates the textbox.
    The code i've written looks like this:

    ' code for setting up a connection object
    xxxx
    xxxx
    strSQL = "select itemNo, itemDesc from Item"
    rstItem.Open strSQL, CnnAdo, adOpenDynamic

    ' bind the recordset to the adodc controller
    Set Me.adcItem.Recordset = rstItem

    ' bind the combo box to the adodc controller
    Set cboItem.DataSource = adcItem
    cboItem.DataField = "ItemNo"
    Set cboItem.RowSource = adcItem
    cboItem.ListField = "ItemNo"

    ' bind textbox
    Set txtItemDesc.DataSource = adcItem
    txtItemDesc.DataField = "ItemDesc"

    I don't know what's wrong with this bit of code, but there must be some minor changes that i have to do.

    Thanks
    Erik L

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    use the change event

    in the DBCombo1_Change

    requery the statement


    "Select itemDesc from Item where itemNo=" & DBCombo1.boundcolumn

    me.textbox=rs.itemDesc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •