Combo Box Control, Table Fields.
You can use the LimitToList property to limit a combo box’s values to the listed items.
The LimitToList property has the following settings.
Setting |
Description |
Visual Basic |
Yes |
If the user selects an item from the list in the combo box or enters text that matches a listed item, Microsoft Access accepts it. Entered text that doesn’t match a listed item isn’t accepted. The user must retype the entry, select a listed item, press ESC, or click Undo on the Edit menu. |
True (-1) |
No |
(Default) Microsoft Access accepts any text that conforms to the ValidationRule property. |
False (0) |
You can set the LimitToList property in the combo box’s property sheet, a macro, or Visual Basic.
For table fields, you can set this property in table Design view for fields with the DisplayControl property set to Combo Box or List Box.
Note Microsoft Access sets this property automatically when you select Lookup Wizard as the data type for a field in table Design view.
When the LimitToList property of a bound combo box is set to No, you can enter a value in the combo box that isn’t included in the list. Microsoft Access stores the new value in the form’s underlying table or query, not the table or query set for the combo box by the RowSource property. To have newly entered values appear in the combo box, you must add the new value to the table or query set in the RowSource property using a macro or Visual Basic event procedure.
Setting both the LimitToList property and the AutoExpand property to Yes lets Microsoft Access find matching values from the list as the user enters characters in the text box portion of the combo box.. When the LimitToList property is set to Yes and the user enters a combo box initialized with a non-Null value, Microsoft Access will not allow the user to exit the combo box without having made a selection. If the combo box is initialized with a Null value, the user may make a selection, clear that selection and exit the control leaving a Null value.
Note If you set the combo box’s BoundColumn property to any column other than the first visible column, then the LimitToList property is automatically set to Yes.
NotInList Event.