Bill Bisco
Custom User Title
- Local time
- Today, 12:47
- Joined
- Mar 27, 2009
- Messages
- 92
Dear all,
I have searched the internet and found several helpful threads such as the following below:
Has anyone developed any code to do such a thing so far? Restrict the user's ability to only type what is already present on the list?
Any help is appreciated,
Bill
I have searched the internet and found several helpful threads such as the following below:
If LimitToList is True, you can put code in the combo box's NotInList event.
You can display your own message should you want, or choose not to display
anything. In either case, set
Response = acDataErrContinue
However, none of them succinctly deal with the main issue I feel is important. I want the user to be able to type in a combo box an item in a predefined value list or click the down arrow and choose from the list, but should only be able to type characters which are present in the list itself, for example. If I had a list of the following words:Public Function InTheList(CheckList As ComboBox) As Boolean
'#############################################################
'## This takes the current text from the combo and compares ##
'## to each item in the list. If an item matched then the ##
'## function is set to True. Else set to False ##
'#############################################################
Dim x As Integer
If CheckList.ListCount > 0 Then
For x = 1 To CheckList.ListCount
If CheckList.Text = CheckList.List(x - 1) Then
InTheList = True
GoTo EndThisNow
Else
InTheList = False
End If
Next x
Else
InTheList = False
End If
EndThisNow:
End Function
- Red Rose
- Ruby Rose
- Yellow Rose
Has anyone developed any code to do such a thing so far? Restrict the user's ability to only type what is already present on the list?
Any help is appreciated,
Bill