Add a new value directly into a combo box
Insert the following into the NotInList event of your combo box
See attachedCode:Private Sub ComboBox_NotInList(NewData As String, Response As Integer) Dim ctl As Control Dim strSQL As String Set ctl = Me!ComboBox If MsgBox("Value is not in list. Add it?", _ vbOKCancel) = vbOK Then Response = acDataErrAdded strSQL = "INSERT INTO ComboListTable(list) VALUES('" strSQL = strSQL & NewData & "');" CurrentDb.Execute strSQL Else Response = acDataErrContinue ctl.Undo End If End Sub



LinkBack URL
About LinkBacks

Reply With Quote
Bookmarks