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

VB6 Novice - Populating a Combo Box

Status
Not open for further replies.

KenReay

Programmer
Aug 15, 2002
5,424
0
0
GB
Hi

I am a complete VB6 Novice, although experienced in Access/VBA.

Could someone explain how I populate a Combo box from a table.

In Access I can set the rowsourec to an SQL string, is a similar facility available in VB6?, or must I use AddItem?

Thanks in Advance Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Try using a data combo (components - Microsoft DataList Controls 6.0)

These have rowsource, datasource etc
 
Hi

Thanks for that.

I had located the controls you mentioned.

I have placed an ADO Datacontrol on the form, set the Datasource and recordsource.

I have tested this worked by putting a bound textbox on my form, with datasource of my ADO Datacontrol, and Datafiedl set to a column in the recordsource of the datacontrol. If I move through the record set, using the datacontrol navigation buttons then the data in the etxt box changes as you would expect.

For my combo I have set the Datasource to the ADO Datacontrol, and the DataField to a column in the ADODatacontrol.

When I run the form, there is nothing in the dropdown list of the combo, but the text property shows the current value of the column and changes as I advance through the recordset using the ADODatacontrol navigation buttons.

I probably doing something basicly stupid, but I just cannot see what it is.

Any suggestions? Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I think for the data combo you need to set the rowsource and rowmember property as well as the datasource property.

If this doesn't work, let me know and I'll double check.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top