Solved

Defining contents of Combo box

Posted on 2016-08-08
4
60 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
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 34

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now