Solved

Defining contents of Combo box

Posted on 2016-08-08
4
50 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the help - just the job.  I actually used a combination of all three responses and it's fine.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
This collection of functions covers all the normal rounding methods of just about any numeric value.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
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…

743 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

17 Experts available now in Live!

Get 1:1 Help Now