How to get two fields to show in a combo box

  • Thread starter Thread starter Jeremy
  • Start date Start date
J

Jeremy

Hello all. I've been through the help file a couple of time and I can't seem
to find the answer to this question.

I have a bound combo box that is using 3 fields, CSM ID, CSM First Name, CSM
Last Name. I have CSM ID hidden, both of the column widths of the first and
last name set to 1", they're both visible in the drop down, but when I select
an entry, only the first name shows in the combo box. What am I missing?

Thanks!
 
Check the source SQL and change from this --
SELECT [CSM ID], [CSM First Name], [CSM Last Name]....
to this --
SELECT [CSM ID], [CSM First Name] & " " & [CSM Last Name]....
 
Hi Jeremy,

That's standard behaviour for a combo-box. When not dropped down, only the
first visible field shows. If you need both names to show, concatenate the
names into a single field.

HTH,

Rob
 
Karl, you are a genius! Thank you very much!

KARL DEWEY said:
Check the source SQL and change from this --
SELECT [CSM ID], [CSM First Name], [CSM Last Name]....
to this --
SELECT [CSM ID], [CSM First Name] & " " & [CSM Last Name]....

--
Build a little, test a little.


Jeremy said:
Hello all. I've been through the help file a couple of time and I can't seem
to find the answer to this question.

I have a bound combo box that is using 3 fields, CSM ID, CSM First Name, CSM
Last Name. I have CSM ID hidden, both of the column widths of the first and
last name set to 1", they're both visible in the drop down, but when I select
an entry, only the first name shows in the combo box. What am I missing?

Thanks!
 
Thanks for the input. I am a complete Access noob but an area at work is so
disorganized that I decided to give it a try to see if I could make sense out
of non-sense. I created a field for first and last name for maximum
flexibility until I get more familiar with Access. With Karls suggestion, I
just set the last name column width to 0 and it made it act exactly like I
wanted.
 
Creating two fields (or more) to contain the name is a very good idea. It
does give you maximum flexibility and makes it easy to display the names in
many different formats by using concatenation.

LastName & ", " & FirstName
FirstName & " " & LastName
FirstName
LastName

If you had just one field for the entire name it becomes very difficult to get
the separate parts and rearrange the name parts.

One tip, don't use spaces in your table and field names. It won't hurt right
now, but eventually you will find it makes life more complex. Names of fields
and tables should consist of only letters, numbers, and the underscore
character. Also avoid Name, Date, Time and other reserved words.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
Thanks for the info. I learned very quickly about the spaces in names. I have
since gone back and removed them all and followed the Hungarian notation. It
makes entering names and sorting them much easier.
 
Back
Top