Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-28-2018, 06:25 PM   #1
jat1
Newly Registered User
 
Join Date: Sep 2018
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jat1 is on a distinguished road
Combo box update

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 ?

jat1 is offline   Reply With Quote
Old 09-28-2018, 07:44 PM   #2
GinaWhipp
AWF VIP
 
GinaWhipp's Avatar
 
Join Date: Jun 2011
Location: Ohio, USA
Posts: 5,383
Thanks: 21
Thanked 898 Times in 882 Posts
GinaWhipp has a spectacular aura about GinaWhipp has a spectacular aura about
Re: Combo box update

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
__________________
Gina Whipp
Microsoft MVP (Access 2010-2015)


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
GinaWhipp is offline   Reply With Quote
Old 09-28-2018, 08:40 PM   #3
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 28,272
Thanks: 15
Thanked 1,595 Times in 1,515 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
Re: Combo box update

Before you close your popup form, you must requery the combo.

Forms!originalform!cboyouareupdating.Requery

__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
Old 09-29-2018, 11:53 AM   #4
jat1
Newly Registered User
 
Join Date: Sep 2018
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jat1 is on a distinguished road
Re: Combo box update

Thx for the help
jat1 is offline   Reply With Quote
Old 09-29-2018, 08:50 PM   #5
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 28,272
Thanks: 15
Thanked 1,595 Times in 1,515 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
Re: Combo box update

You're welcome
__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
Old 09-30-2018, 03:21 AM   #6
mike60smart
Newly Registered User
 
mike60smart's Avatar
 
Join Date: Aug 2017
Location: Dunbar, Scotland
Posts: 446
Thanks: 21
Thanked 90 Times in 89 Posts
mike60smart will become famous soon enough
Re: Combo box update

Or you can use the On Enter of the Combobox:-

Me.ComboboxName.Requery

mike60smart is offline   Reply With Quote
Reply

Tags
combo box , table update

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
update 2nd combo box and subform with 1st combo box hasanrazaj1 Forms 2 05-09-2010 01:12 AM
Combo box performs query, update combo box with only result? Macinslaw Forms 2 08-04-2006 11:01 AM
Re: combo box will not update alicejwz Forms 1 12-07-2004 07:39 AM
Combo box update REDaughdril Forms 1 10-29-2004 10:59 PM
combo box to update two fields after update jemar707311 Forms 8 08-24-2001 07:22 AM




All times are GMT -8. The time now is 03:46 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World