G
Gary
Is there a way that I can make a combo box pull data from multiple fields.
Thanks
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Gary said:Is there a way that I can make a combo box pull data from multiple fields.
Graham Mandeno said:Hi Gary
You mean you want values from multiple fields to appear in the one column?
Like: Firstname="Fred", Lastname="Smith", Combo shows: "Fred Smith"
To do this you concatenate the two fields using a string expression in
your RowSource query. For example:
Select Firstname & " " & Lastname as Fullname from Clients;
Of course, combo boxes can and usually do have more than one column, and
that is reflected by the number of columns (fields) in your rowsource
query. For example:
Select ClientID, Firstname & " " & Lastname as Fullname, City, Phone
from Clients order by Firstname, Lastname;
This would give you four columns. You set the ColumnCount property to
match.
The BoundColumn property indicates which column will hold the Value of the
combo box.
The ColumnWidths property sets the widths of the individual columns. A
width of zero hides the column completely (common for such fields as
autonumber IDs). The first column with a non-zero width will be the one
displayed when the combo is not dropped down.
The Column property of the combo returns the data in any column - for
example, with the above RowSource, cboName.Column(2) would return the City
(third column) of the currently selected client (note the numbering starts
at 0).
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Gary said:Is there a way that I can make a combo box pull data from multiple
fields.
Thanks

Gary said:Graham,
What I am trying to do is search three different fields that are labeled
"Head Tenant" ; "Co-Tenant" & Co-Tenant" from one combo box and have the
result entered into a form. The way I am doing it now is I have a box for
each field and if I don't know which type of tenant I am looking for I
might have to do this 3 time till I find the correct field that the name
resides in. I would sure save a lot of work if I could search all 3
fields a one time. The other issue I thought about was what if I had
several people with the same name...could I be made to show all of them I
could choose the correct one. I thought I could do this by have a
multiple column combo box, and have the second column searchable by SS#.
Thanks for any help you can give me.
Gary
Graham Mandeno said:Hi Gary
You mean you want values from multiple fields to appear in the one
column?
Like: Firstname="Fred", Lastname="Smith", Combo shows: "Fred Smith"
To do this you concatenate the two fields using a string expression in
your RowSource query. For example:
Select Firstname & " " & Lastname as Fullname from Clients;
Of course, combo boxes can and usually do have more than one column, and
that is reflected by the number of columns (fields) in your rowsource
query. For example:
Select ClientID, Firstname & " " & Lastname as Fullname, City, Phone
from Clients order by Firstname, Lastname;
This would give you four columns. You set the ColumnCount property to
match.
The BoundColumn property indicates which column will hold the Value of
the combo box.
The ColumnWidths property sets the widths of the individual columns. A
width of zero hides the column completely (common for such fields as
autonumber IDs). The first column with a non-zero width will be the one
displayed when the combo is not dropped down.
The Column property of the combo returns the data in any column - for
example, with the above RowSource, cboName.Column(2) would return the
City (third column) of the currently selected client (note the numbering
starts at 0).
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Gary said:Is there a way that I can make a combo box pull data from multiple
fields.
Thanks
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.