G Guest Jan 9, 2004 #1 How do I add an item automatically in a combo box by using the OnNotinList event?
A Arvin Meyer Jan 10, 2004 #2 TSS said: How do I add an item automatically in a combo box by using the OnNotinList Click to expand... event? How about something like this, just add some error handling (aircode): Sub cboWhatever_NotInList(NewData As String, Response As Integer) Dim db As DAO.Database Dim rst As DAO.Recordset Set db = CurrentDb Set rst = db.OpenRecordset("tblYourTable", , dbAppendOnly) With rst .AddNew !Whatever = NewData .Update .Close End With Response = acDataErrAdded rst.Close Set rst = Nothing Set db = Nothing End Sub -- Arvin Meyer, MCP, MVP Microsoft Access Free Access downloads: http://www.datastrat.com http://www.mvps.org/access
TSS said: How do I add an item automatically in a combo box by using the OnNotinList Click to expand... event? How about something like this, just add some error handling (aircode): Sub cboWhatever_NotInList(NewData As String, Response As Integer) Dim db As DAO.Database Dim rst As DAO.Recordset Set db = CurrentDb Set rst = db.OpenRecordset("tblYourTable", , dbAppendOnly) With rst .AddNew !Whatever = NewData .Update .Close End With Response = acDataErrAdded rst.Close Set rst = Nothing Set db = Nothing End Sub -- Arvin Meyer, MCP, MVP Microsoft Access Free Access downloads: http://www.datastrat.com http://www.mvps.org/access