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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't display recordset details in datacombo.

Status
Not open for further replies.

sm1it

Programmer
Jun 28, 2004
6
GB
Hi, I have an application which displays data in TextBoxes and DataCombos(Style 2) depending on which Main Record is selected from a Main DataGrid.

The Main DataGrid's DataSource is adodcMain. On adodcMain.MoveComplete a RecordSet (rsOneRec) is created based on details from the DataGrid. TextBoxes and DataCombos are then populated (provided there is a record) along the lines of:

Code:
txtDetail(14).Text = rsOneRec!mg_branch & Empty
txtDetail(15).Text = rsOneRec!mg_depart & Empty

This is fine, however I can't display corresponding
details in the DataCombos.

The DataCombos (5) are populated at the Sub Loader stage by RecordSet's made up of a Description_Code and a Description. The BoundColumn (Description_Code), RowSource and ListField(Description) propertys are all set at this point.

I've tried:

Code:
dcboDept.DataField = ""
Set dcboDept.DataSource = rsOneRec
dcboDept.DataField = Description

but nothing is displaying in the DataCombos.

Thanks in advance for any help.
p.s. there is a reason I'm using RecordSets and not Adodcs
 
Look at the RecordSource and ListField properties instead of DataSource and DataField.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 

Since you populate your array of text boxes from the rsOneRec,
you may as well do this with just 'regular' combo box:

Code:
rsOneRec.Open ""Select Description from Table Where...", Cnn

cboDept.Clear

For i = 1 To rsOneRec.RecordCount
    cboDept.AddItem rsOneRec!Description
    rsOneRec.MoveNext
Next i

rsOneRec.Close

cboDept.ListIndex = 0

HTH

---- Andy
 
Sorry, maybe wasn't clear about my problem.

I'm writing a database application.
The User is able to write free text in the TextBoxes, but is limited to a choice from the list in the DataCombo. The DataCombos are populated ok with a list of "Description" and a BoundColumn of "Description_Code".

Upon saving, the free text and "Description_Code" are written to a table.

It's when viewing the records in the application and moving between records (adodcMain.MoveComplete) I can't get the DataCombo to display the corresponding "Description".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top