Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Dim strsql As String Dim i As Integer Dim Msg As String Dim s As String 'Exit this sub if the combo box is cleared If NewData = "" Then Exit Sub Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr Msg = Msg & "Do you want to add it?" i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Item...") strsql = fProperCase(NewData, 1) If i = vbYes Then s = fProperCase(NewData, 1) strsql = "INSERT INTO tblCompany(CompanyName) " _ & " SELECT '" & s & "';" CurrentDb.Execute strsql, dbFailOnError Response = acDataErrAdded Else Response = acDataErrContinue Me.Undo End If
Join the community of 500,000 technology professionals and ask your questions.