Results 1 to 4 of 4
  1. #1
    jmuirman1 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    84

    How to Add Item to Combo Box and requery

    I created a combo box [combo1468] with values from a table "ASSIGNOR-UNDERWRITING LIST" . works great.



    i want to add a new item to the list and be able to choose that item from the combo box without closing and opening the main form

    i created an add new item form and tried to requery. I get a "run-time error '2465'Microsoft can't find(the combo box field.

    the code i used is:

    Private Sub Form_Close()

    Forms!assignorlistF!Combo1468.Requery


    End Sub

    can anyone help?

    combo box Row Source
    SELECT [ASSIGNOR-UNDERWRITING COMPANY LIST].[assignorID], [ASSIGNOR-UNDERWRITING COMPANY LIST].[Underwriting Company], [ASSIGNOR-UNDERWRITING COMPANY LIST].[Parent Carrier], [ASSIGNOR-UNDERWRITING COMPANY LIST].[Domiciliary Address], [ASSIGNOR-UNDERWRITING COMPANY LIST].[State], [ASSIGNOR-UNDERWRITING COMPANY LIST].[Tax ID] FROM [ASSIGNOR-UNDERWRITING COMPANY LIST] ORDER BY [Underwriting Company];

    thanks,

    John

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Run an append query to add the item to the combo source table.
    then refresh the combo to get the new values. (done on the form with the combo)

    docmd.openquery "qaAddNewVal"
    cboBox.requery

    if not in the form with combo, then use the full path:
    forms!fMyForm!cboBox.requery

  3. #3
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Or you might want to look at the NotInList event of the combo:
    https://docs.microsoft.com/en-us/off...obox.notinlist
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi John

    The Not In List Event is the way to go with this.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-21-2018, 08:42 AM
  2. Combo Box Will Not Requery
    By clchapin in forum Programming
    Replies: 3
    Last Post: 08-01-2013, 08:51 AM
  3. Replies: 2
    Last Post: 06-03-2013, 11:52 AM
  4. Replies: 1
    Last Post: 07-12-2012, 08:39 AM
  5. Replies: 1
    Last Post: 03-13-2011, 02:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums