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

    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 is online now Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    2,507
    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
    7,152
    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.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    "Everyone has a photographic memory; some just don't have film." Steven Wright

  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
    14,930
    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 Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2020
    Posts
    20
    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
    7,152
    Forms!InputFormName.ComboBox.Requery

    The form would have to be open but could be invisible.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    "Everyone has a photographic memory; some just don't have film." Steven Wright

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 - Senior Forums