Combo box update (1 Viewer)

jat1

New member
Local time
Today, 12:30
Joined
Sep 23, 2018
Messages
2
I have a command button next to my combo box to add data in an other table that’s not in my combo box but when I add the data for the combo box to the table and exit the table it does not show up in my combo box. How can I update table after I close it so the data I entered shows up in combo box ?
 

GinaWhipp

AWF VIP
Local time
Today, 15:30
Joined
Jun 21, 2011
Messages
5,901
Why not just use the Not_in_List event?

Code:
    'Get confirmation that this is not just a spelling error.
    strSQL = "Add '" & NewData & "' as new Category?"
    If MsgBox(strSQL, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then
        
        'Append the NewData
        strSQL = "INSERT INTO tblCategories ( cCategoryName ) " & _
                    "SELECT """ & NewData & """"
                  CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges
            
        'Notify Access about the new record, so it requeries the combo.
        Response = acDataErrAdded
    Else
        DoCmd.RunCommand acCmdUndo
        Response = acDataErrContinue
    End If
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:30
Joined
Feb 19, 2002
Messages
42,973
Before you close your popup form, you must requery the combo.

Forms!originalform!cboyouareupdating.Requery
 

mike60smart

Registered User.
Local time
Today, 19:30
Joined
Aug 6, 2017
Messages
1,899
Or you can use the On Enter of the Combobox:-

Me.ComboboxName.Requery
 

Users who are viewing this thread

Top Bottom