Full Version: Form, Combo Button, Control Source - Multiple Fields?
UtterAccess Forums > Microsoft® Access > Access Forms
aprykhus
In access I want a ControlSource that displays the same multiple fields that displays in the row source property. When I click the drop down combo botton I want the same multiple fields to show from that in the ControlSource.
The question is how can I display multiple fields in a ControlSource?
Attached is a screenshot for better communication of the problem.
Jack Cowley
You can use a list box or you can concatenate the data that is displayed in your combo box. You cannot display multiple columns in a combo box when it is not 'open'.
th,
Jack
KenSnell
Terminology corrections here.
The area that you're calling "control source" is the "textbox" portion of a combo box. The control source of a combobox (or any control, for that matter) is the field to which the control is bound (the field must be in the form's RecordSource query), or it is an expression that calculates a value (not very useful for a combo box, though).
The textbox portion of a combo box can display only one column from the combo box's RowSource query. And by design it will display only the first visible column of the RowSource (see ColumnWidths property of the combo box).
You cannot achieve what you want in a combo box unless you change the RowSource to create a concatentated string of all the columns' data into the first visible column; of course, that will also show in the drop down list, which kinda defeats the purpose.
Otherwise, you would need to write code to swap back and forth between a combo box and a textbox, where the textbox would be given the "concatenated" value to display when the combo box does not have the focus -- note: this gets pretty tricky if you want the textbox to be seen and the combo box not seen, and vice versa.
Perhaps a listbox will better serve your purposes? It displays all columns of all rows continually, and has many of the same features/characterstics of a combo box.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.