+ Reply to Thread
Results 1 to 1 of 1

Thread: Combo Box - Add Entry Not In List

  1. #1
    Lightning Master AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123's Avatar
    Join Date
    Mar 2008
    Location
    Fortress Of Solitude
    Posts
    394
    Rep Power
    7

    Combo Box - Add Entry Not In List

    Add a new value directly into a combo box

    Insert the following into the NotInList event of your combo box

    Code:
    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
    
    See attached
    Attached Files
    If i helped you, make me famous by clicking the

+ Reply to Thread

Similar Threads

  1. Quick Links - Combo Open Forms
    By AOG123 in forum Access Database Samples
    Replies: 0
    Last Post: June 4th, 2008, 09:46 AM
  2. Dynamic Combo Maker
    By mehere in forum ASP Code Samples
    Replies: 0
    Last Post: March 28th, 2008, 10:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO