ACC2: Cannot Clear Selection in LimitToList Combo BoxID: Q123737
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you delete the selected entry in a combo box, you may receive the
following error message:
The text you enter must match an entry in the list.
The combo box's LimitToList property is set to Yes. When a combo box's LimitToList property is set to Yes, an empty selection does not match any value in the list. This behavior makes clearing a selection in the combo box difficult.
You can work around this behavior by including the following Access Basic
procedure in a new or existing module in your database and calling it from
the Change event of your combo box:
Sub AdjustEmptyCombo (C As Control)
On Error Resume Next
If IsNull(C.Text) Or C.Text = "" Then C = Null
End Sub
Sub Employee_ID_Change ()
AdjustEmptyCombo Me![Employee ID]
End Sub
This behavior no longer occurs in Microsoft Access version 7.0.
The text you enter must match an entry in the list.
Option Explicit
Sub AdjustEmptyCombo (C As Control)
On Error Resume Next
If IsNull(C.Text) Or C.Text = "" Then C = Null
End Sub
Sub Employee_ID_Change ()
End Sub
Sub Employee_ID_Change ()
AdjustEmptyCombo Me![Employee ID]
End Sub
For more information about the NotInList event, search for "NotInList," and then "NotInList Event" using the Microsoft Access Help menu.
Keywords : kberrmsg kbusage FmsCmbo
Version : 2.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: April 8, 1999