If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > adodc and combo boxes problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-06-03, 13:09
swedstar swedstar is offline
Registered User
 
Join Date: May 2003
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 10-23-03, 06:15
Marvels Marvels is offline
Registered User
 
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
use the change event

in the DBCombo1_Change

requery the statement


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

me.textbox=rs.itemDesc
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On