Results 1 to 14 of 14
  1. #1
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45

    Update Combo Box after entering new info

    I have a form that uses a combo box to display a name instead of the ID number but that stores that ID number into the appropriate field. The combo box pulls it's list from a table

    My question is this: Is it possible to refresh that combo box after using a different form to enter information about that field? Or is it possible to include that different form as a subform and then refresh the combo box after inputting the correct information into the subform?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You should be able to requery the combo.

    Forms!FormName.ComboName.Requery
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45
    which form event property should I put that under? I tried On Got Focus and it didn't do it

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, that's VBA code so it would go here:

    http://www.baldyweb.com/FirstVBA.htm

    The appropriate event would be up to your application. Got focus should work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45
    Ok, I'm fairly new at VBA but from what I understand, I did that and it didn't work.

    Here is what my code looks like on the originating form

    Code:
    Private Sub Form_GotFocus()
        CaptainCombo.Requery
    End Sub
    this didn't requery the combo box after closing the form that I made to input values into that table. Here is the database I'm working on. The "New Teams" form has a control to open the "New Captain" form. After inputting the data into that form and it's been closed, I want it to update the "CaptainCombo" combo box in the "New Teams" form.
    3-on-3 NEW.zip

    Edit: I put that same code into the Mouse Move event in the detail section and it does requery that combo box.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I thought you meant the got focus event of the combo. I'd try there or in the code that closes the other form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45
    Putting it in the got focus event of the combo worked like a charm! Thanks!!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Monterey_Manzer is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    164
    I am interested in doing something similar to justgeig's combo box and I am hoping you can point me in the right direction. I have a form in which my coworkers need to enter data and for PII reasons the table this form corresponds to cannot store names (uploading to SharePoint). We do use an ID number and I have a table in the locally hosted Access database that links the ID and the names but I can't seem to build an expression that will find them for me. Should I approach this via an Expression in the Control Source, a Macro, or some VBA code?

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'm pretty sure SharePoint can handle names, but in what situation are you trying to do this? You could have a combo that got both fields from the local table via SQL.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Monterey_Manzer is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    164
    We can't do names for legal privacy reasons. We use a form to enter records into a table that contains specific details including an ID number that links each record to a corresponding person. I have a local table that matches the ID and the name of the person (different fields for first and last). I would like either just a text box or a combo box that matches the ID number entered in the form to the corresponding name in the local table and displays that matching name. I'm just learning what can be done with VBA, SQL, and Macros and I'm not sure which avenue to pursue at this point.

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I would use a combo where the control source was the field in the SharePoint table (presuming the form is bound to that table). The row source would be SQL that returned the ID and name, the bound column would be the ID field. The combo wizard should walk you through it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    Monterey_Manzer is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    164
    Thanks! This worked wonderfully.

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem, and welcome to the site!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. More Info" button based on Combo Box selection
    By kriskeven in forum Access
    Replies: 1
    Last Post: 05-21-2012, 02:23 PM
  2. Replies: 2
    Last Post: 11-02-2011, 08:10 PM
  3. Update form with table info
    By Hannah's momma in forum Forms
    Replies: 0
    Last Post: 03-23-2011, 12:20 PM
  4. Entering Text in Combo Form
    By Bobt in forum Forms
    Replies: 2
    Last Post: 10-22-2010, 03:53 AM
  5. Replies: 8
    Last Post: 04-21-2010, 06:43 AM

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