The combobox represents a text field in the table, so on Form Current I populate the cbo with the value of that field and After Update of the cbo I populate the field with its value.
The cbo has these properties: no Control Source; Row Source is the value list; Bound Column 1; Limit to List - Yes; Allow Value List Edits - Yes
The NotInList event has this code, and it works.
Code: Select all
Private Sub cboTrngSession_NotInList(NewData As String, Response As Integer) Dim ctl As Control Dim strAdd As String Set ctl = Me!cboTrngSession If MsgBox("The session designation '" & NewData & _ "is not in the list. Add it?", _ vbYesNo) = vbYes Then strAdd = Chr(34) & NewData & Chr(34) Response = acDataErrAdded Debug.Print ctl.RowSource ctl.RowSource = ctl.RowSource & ";" & strAdd 'NewData Debug.Print ctl.RowSource Else Response = acDataErrContinue ctl.Undo End If End Sub
I see that the cbo itself has an editing tool that appears when the list is dropped down, and that’s an adequate feature. But at this point I’m curious about why NotInList isn’t working.