Combo Box (1 Viewer)

cktcPeterson

Member
Local time
Yesterday, 19:26
Joined
Mar 23, 2022
Messages
73
I have created a combo box on my form
Under row Source I have my desired fields
Name
Student ID

On the combo box, I want to select/type a name, but input the student id into the field.

Currently, I have in row source query
Name First (Ascending)
Student ID

I want to search by name and return the Student ID

I am able to see both columns

Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:26
Joined
May 7, 2009
Messages
19,230
is your combo bound?
set the Bound Column to 2.
set the Column Width to 1;0
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 04:26
Joined
Jul 9, 2003
Messages
16,280
You might find my Blogs on Combo Boxes useful:-

Combo Boxes - In the Beginning - Nifty Access​



Get Info From a Combo-box 1 - Nifty Access​

 

cktcPeterson

Member
Local time
Yesterday, 19:26
Joined
Mar 23, 2022
Messages
73
It is still now working the way I hope for
My drop-down shows

Name Student ID

Which I want.

I want to type in the name, but returns the student id. Currently when I type in Mrs Ann, it show Ms Ann.

1658245995596.png

1658246029361.png

1658246066380.png


Thanks everyone for the quick response and help.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:26
Joined
Feb 19, 2002
Messages
43,257
Just FYI,

Although the sequence of the columns in the RowSource is not relevant as long as you choose the correct column as the bound column, conventionally, the UniqueID column is selected FIRST in the RowSource. Therefore, the bound column would normally be column 1. Then, because most people want to select using the text value, the Column width property is used to hide the ID. So if you have only the two columns, the Column Widths will be 0", 2". The 0 width essentially hides the numeric value. The first column with a non-zero width is the column that shows when the combo is at rest.

When you have no specific reason to go against "normal", don't deviate just because you can. You will just confuse yourself and anyone else who has to work with the application if they are not aware of how the combo and listboxes actually work.

A reason to deviate could be that you want the combo to show both the string and the ID when it is expanded and you want the string to be displayed when the combo is "at rest". In that case, the select would be text, ID and the Column widths would be 2", 1" and the bound column would be 2. Most applications never show the unique ID, hence the convention as I described it.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 04:26
Joined
Feb 19, 2013
Messages
16,605
Don’t use non alphanumeric in field and table names - will cause unexpected errors.

with regards mrs Ann and ms Ann - do they have the same studentid?

if so it will choose the first one it comes to
 

Users who are viewing this thread

Top Bottom