Results 1 to 6 of 6
  1. #1
    AndyRob1973 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2020
    Posts
    81

    updating the combo box query when it is clicked

    Hello,

    I have a form with a combo box whose contents are a unique list of people in a table (let's all it tblPeople). I use a query to obtain this list.

    On this form I have a button which takes you to another form which allows you to input into tblPeople.

    When I go back to the original form ad click on the combo box, I cannot see the new entry. I have to close it down and reopen.

    Could someone point me in the right direction. I have tried an on click event of DoCmd.requery but this doesn't seem to wok.



    Thanks,

    Andy

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,535
    Try:

    Me.NameOfComboBox.Requery

    in the Got Focus event of the combo box

    Substiute NameOfComboBox with the name of your Combo box
    Last edited by Bob Fitz; 07-21-2020 at 08:16 AM. Reason: Clarification
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    Or requery the combo in the close event of the input form rather than every time it gets the focus, which disregards whether or not a value was just added to the list.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    I agree with the other responders. However, you may get some additional insight from this video by Richard Rost on Edit Combo List Item.

  5. #5
    AndyRob1973 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2020
    Posts
    81
    Thank you all.

    I have gone down the Got Focus route and that seems to work.

    However, just so I understand, if I wanted to requery when closing the input form, would it be:

    InputFormName.ComboBox.Requery ?

    because the combobox is on a different form than the input form

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    Forms!InputFormName.ComboBox.Requery

    The form would have to be open but could be invisible.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 6
    Last Post: 08-05-2016, 10:57 PM
  2. Replies: 12
    Last Post: 02-15-2016, 11:10 AM
  3. Combo box based on query not updating
    By shaunacol in forum Forms
    Replies: 4
    Last Post: 07-13-2015, 02:20 PM
  4. Replies: 4
    Last Post: 08-09-2014, 02:33 PM
  5. Replies: 4
    Last Post: 06-09-2014, 10:34 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