Wrong value from combo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a 2 column combo with a long list of names, Last Name + First name.
When the user scrolls down and selects a name, my code transfers this value
to a text field, but instead of using the selected value it take the first
value of the same surname.

So for example if I have 20 people with the name "Smith" and the list starts
with "Alan Smith" and ends with "Zoe Smith" whichever Smith I choose, its
always the first occuarance of the suranme is picked i.e. Alan Smith.

I guess I'm missing something quite simple.

Any pointers are much appreciated.

thanks

Winger
 
Post the SQL statement of the combo box's Row Source query. Post the code
that you're using to transfer the value.
 
If you have last name as a column and first name as another column, this will
happen. Combo boxes don't like duplicate values in the Bound column. You
may need to concatenate the two into one column.
 
Duplicate names are a problem -- count on it, somewhere in the world there
are two Zbigniew Przybylynskis, and sooner or later they'll both wind up in
your database! ;>)

Hopefully in the table where your names reside, there's also somesort of a
unique key field that associates one-to-one with the names. (I.e., you might
have ten David Smiths, but every one of them has a different, unique ID
number.) Make that the bound column in your combo box with a zero width. It
won't show in the dropdown, but that's the value that will be stored, and
whatever you try do do based on the value in that combo box, you can be sure
you're working with the correct person.
 
Back
Top