Site Search:
Sign in | Join | Help
4Penny.net

Microsoft Access

Tricks and Tips for Microsoft Access

July 2007 - Posts

  • Code to add items to a dropdown list in Access

    Private Sub cboSourceCodeTable_NotInList( _
                 NewData As String, Response As Integer)
      On Error Resume Next
      Response = acDataErrContinue
      If MsgBox("The source code '" & NewData _
              & "' is not in the list." _
              & vbLf & "Do you wish to add it?", _
              vbYesNo) = vbYes Then
        CurrentDb().Execute "insert into LeadSourceCode(Description) values ('" _
                          & NewData & "')"
        Response = acDataErrAdded
      End If
    End Sub