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

Populating a combo box with data from an Access Database Field. 1

Status
Not open for further replies.

Giblets

Programmer
Feb 19, 2003
6
GB
Hi,I was wondering if anyone knew how to link a combo box to a database field and populate that combobox with the data from the field.Thanks for your time.
 
From other posts in this forum, it would appear that it doesn't work directly. I don't know for sure because I don't do that. I use recordsets to retrieve the data from the database and then pass through the recordset and add the items to the combobox. BlackburnKL
 
It is possible to link a combo box to a field in table.
Your Form will have to be linked to that table.
Your combo box properties:
*Control Source: must be set to the field name
*Row Source Type: must be set to table/query
*Row Source: must be set to the name of the table or query.
*Bound Column: must be set to the column number that your field occupies inside your table/query (usually the first one which most of the times is the key index of the table)
*Column Count: must be set to the number of columns you want displayed in the combo box's pop up list.
*Column widths: you have to play a little bit with this one in order to get the right numbers, each column width must be separated by a comma and its usually measured in inches.
(I normally use 0.5" for numbers 3 digits long and 3" for strings [aprox 40 characters long])
If this doesn't meet your needs let us know specifically what is that you want to achieve (I found that the above explained doesn't work that great when the field you want to play with is not the key index and the first column in your table).

Good Luck!!
 
You can do it with a combo box and a DAO data control, or a DataCombo and an ADO data control - binding the control to the source, or with a combo box and fill control with data manually.
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top