I'm having some problems finding the proper VBA syntax for checking to see if the text in a textbox is contained in a
combobox. I'd know how to do this in VB.Net, but unfortunately I'm using VBA.
I have a sub-form where all the data is bound from one table, and have added a combobox to this sub-form in which it is not
bound, but gets it's data from a seperate table.
The main table that has everything bound has a field called "Type" that has user entered data, and several hundreds of
records that have variations of the spellings or type, so I have made a seperate table that contains a list of the 8 or so
main "Type"s, including one for Other which is not found in the Type field for the main table.
What I want to do is check to see if the value of the bound textbox of Type is one of the types in the Combo box, if it is I
want to have the textbox be blank, the combobox's type to be selected.
If the type is not found in the combobox's list, I want to have the combobox to display "Other", have the bound textbox
remain as it is with the type in it. Under this condition, if the textbox's text is misspelled and then corrected, or if a
different value is picked from the combobox, it needs to change to the condition of where the textbox text is found in the
On the update, it needs to change the textbox text back (as it's bound) to the value of the combobox text (unless the
combobox is of type other, in which case it'll simply remain as the textbox value).
So, my question is how can I determine if the value of a textbox is listed in a combobox, and are there any other potential
problems I should take into consideration?
I'm planning on doing all the loading on the Form Load event, and on the Form UnLoad Event I will put the value of the
combobox back into the textbox.