Combo Box Display Option

G

Guest

Hi there,
I am very new to databases so this may seem like a very novice question but
all help would be very welcome.

i have a combo box that is related to 2 fields in a table e.g LastName &
FirstName
My Problem is when the list is pulled down the fields appear as

LastName|FirstName

in 2 seperate Columns of the drop down box. I've seen it done elsewhere but
can't remember where exactly, could someone tell me how i can make the drop
down box display the information like this:

LastName,FirstName

in the same Column

thanks for any suggestions
 
D

Dirk Goldgar

Halo said:
Hi there,
I am very new to databases so this may seem like a very novice
question but all help would be very welcome.

i have a combo box that is related to 2 fields in a table e.g
LastName & FirstName
My Problem is when the list is pulled down the fields appear as

LastName|FirstName

in 2 seperate Columns of the drop down box. I've seen it done
elsewhere but can't remember where exactly, could someone tell me how
i can make the drop down box display the information like this:

LastName,FirstName

in the same Column

thanks for any suggestions

This is done by setting the combo box's RowSource property, not to the
table itself, but to a query (often expressed as an inline SQL
statement) that combines the two fields into one. You can create this
yourself by opening the form in design view, double-clicking on the
combo box to open its property sheet, going to the Data tab, clicking on
the Row Source line, and then clicking on the "build" button (caption
"...") that will appear at the end of the line.

If the Row Source is currently a table, it will ask if you want to build
a query based on the table. Answer "yes", and the new query will be
displayed in query design view. You can then create a calculated field
in the query by entering this in the field grid:

FullName: LastName & ", " & FirstName

If the LastName and FirstName fields are also in the field grid, delete
them. Then close the query, and let Access update the property.

You'll also need to change the combo box's Column Count property, since
it now has one column where before it had two. Note that, if it
formerly had more columns than the LastName and Firstname, you still
want to keep those other columns, so you must adjust the Column Count
property accordingly. You may also want to go to the Format tab of the
property sheet and adjust the combo box's Column Widths property.
 

Ask a Question

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.

Ask a Question

Top