Determine if combo value is in the list

  • Thread starter Thread starter John J.
  • Start date Start date
J

John J.

I have a combobox in which users can select from the list but they can also
enter a custom value. When executing code from a button I need to determine
if the combobox value is a custom one or picked from the list. Is there a
way to this?
Thank you,
John
 
How is the combo box populated: by a query or by adding entries to it?

If your combo box is being populated from the contents of a table, do you
want their new entry added to that table?

If so, set the combo box's LimitToList property to True, and put code in its
NotInList event. (See http://www.mvps.org/access/forms/frm0015.htm at "The
Access Web" for sample code)

Otherwise, you can always loop through the items in the combo box, comparing
to the value input.
 
John J. said:
I have a combobox in which users can select from the list but they can also
enter a custom value. When executing code from a button I need to determine
if the combobox value is a custom one or picked from the list. Is there a
way to this?


If the combo box's current value is not one of the items in the list, its
ListIndex property will be -1.
 
Back
Top