Solved

Defining contents of Combo box

Posted on 2016-08-08
4
75 Views
Last Modified: 2016-08-09
I have an old application that I would like to do a minor mod on.

Currently I have a form with a passenger selection combo box.
It appears as below.  I am saving the Passenger ID after selection.  
But I don’t necessarily have to view that in the combo box – just the initials and surname for selection.

 Combo box
Anyway, the problem is that the list has got rather long and the users would like to be able to start to type in the combo box surname and see options appear for selection.
I cannot quite figure out how to do that. Currently, of course, that will only work for typing in the ID.

The properties of the Combo box include the following….
Name = cboPassengerID
Control source = tblJourneys.Passenger ID
Row source = SELECT tblPassengers.[Passenger ID], tblPassengers.Initials, tblPassengers.Surname, tblPassengers.Inactive FROM tblPassengers WHERE (((tblPassengers.Inactive)=False)) ORDER BY tblPassengers.Surname;

Any guidance would be most welcome

Regards
Richard
0
Comment
Question by:rltomalin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 125 total points
ID: 41747363
Change the RowSource of the combo box to something like:

SELECT tblPassengers.Surname,
tblPassengers.Initials,
tblPassengers.Inactive,
tblPassengers.[Passenger ID]
FROM tblPassengers
WHERE (((tblPassengers.Inactive)=False)) ORDER BY tblPassengers.Surname;

Then change the BoundColumn property of the combo box to 3 (zero based)
Then change the Column Widths field of the combo box so that the last column (Passenger ID) has a width of zero.
1.  To hide the [Passenger ID] field, change the column widths property of the combo box so that the first field has a width of zero (0).

2.
0
 
LVL 31

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 125 total points
ID: 41747779
A little enhancement to Dale's suggestion:  Make a concatenated LastNameFirst field to display the passenger name as (for example) "Almy, M A",
0
 
LVL 36

Accepted Solution

by:
PatHartman earned 250 total points
ID: 41747906
I prefer to have the bound column first in the query as you have it.  All you have to do is to change the column widths to make the first column width "0".  That will hide the ID field.

I would take Helen's suggestion one step further and order the combo by the lastname/first name field.

@Dale, although the RowSource is a zero based array when you work with it in VBA, for purposes of the interface, it is 1 based.  So, in your example, the bound column would be 4 rather than 3.
0
 

Author Closing Comment

by:rltomalin
ID: 41748680
Thanks for the help - just the job.  I actually used a combination of all three responses and it's fine.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question