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

Microsoft Access

Tricks and Tips for Microsoft Access

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

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.