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

Fill a Combobox through VBA with data from a recordset ?

Status
Not open for further replies.

sogibear

Programmer
Jul 4, 2002
45
GB
Hello,

I have a combox box that i need to fill from within VBA.
I have a recordset that contains the right data, i just don't know how to put the two together,

Help ?
:)
 
Hi

Depends if you want base the combo box on the recordset (so that changes to the recordset will automatically reflect in the combo on requery, or if you want a list frozen as of 'now'

To have a list

set the rowsourcetype to ValueList

Write a loop to read thru your record set and build a string consisting of Rs!FieldValue each one seperated by ;

set the .rowsource to the string value

To base the combo on the record set

set the rowsourcetype property to Table/query

set the rowsource property to the SQL of your recordset

In both cases you will also need to set number of columns, column widths, bound column, by setting the properties of the combo Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top