Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2015
    Posts
    3
    Provided Answers: 1

    Question Answered: Refresh multi-select list to include new lookup contents

    Hello All,

    I am developing a database that contains an inventory of servers and other network resources. I am using Access 2013.

    On the server form is a multi-select list which allows you to select the applications which the server hosts. The applications are stored in a separate table.

    I have added a "Quick Add" feature in which the the server form has a subform on it which is associated with the Applications table. The "Quick Add" subform is set to data entry mode and contains only the application name field. The idea is that if you have not documented the application yet, you can at least get its name into the applications table so that you can choose it from the multi-select list on the server form.

    Here is where I am having an issue. The "Quick Add" subform does indeed add the new application to the applications table. However, the multi-select list does not refresh to show this application when I click on it. I have to close and re-open the server form in order to see it in the multi-select list. This of course defeats the purpose of a quick add subform.

    I have tried adding a requery macro (Control name left blank) to the OnClick event of the multi-select box on the server form. This appears to work only sporadically. Sometimes it is right away to refresh, and sometimes I have to close and re-open the form, etc.

    Can someone suggest how I might get this to work properly? Ideally the contents of the multi-select list would update either when the "add" button is pressed in the quick add subform or when the multi-select list is clicked on.

    Thank you,
    JDDellGuy

    UPDATE:
    Here is more info I have found.
    - If I click "OK" on the combo box, regardless of whether I have selected any boxes, it will refresh the contents of the combo box. The problem is that when it refreshes, it also reloads the server form which loads the first server record again and scrolls the server form back to the top of the page. Obviously this behavior doesn't work well for a quick add box either.

    - Currently I have discovered that I can add a button which when clicked, refreshes the control object for the multi-select box. To me, this is an acceptable manner for it to update as it seems "normal." However, it would be much better if it were entirely automatic, so if someone is still able to provide a suggestion for this, that would be much appreciated.
    Last edited by JDDellGuy; 09-20-16 at 04:40. Reason: Add updated information on more findings

  2. Best Answer
    Posted by JDDellGuy

    "Hi Everyone,

    I figured it out.

    I added an "On Got Focus" event that requery's the "Other Applications" multi-select list. This refreshes the list "live."

    It appears that the "On Click" event occurs when either the "OK" or "Cancel" list box buttons are clicked. "On Got Focus" appears to do the job correctly.

    Also, I needed to specify the "Other Applications" control. I was misunderstanding the info item in Access describing the behavior of leaving the control field blank in the macro. If I leave it blank, i seems it would refresh the "servers" table, not the "Applications" table that the multi-select box was related to.

    Guess I should have help off on posting here for a bit, but I guess the info may help someone else out someday.

    Thanks anyway!
    JDDellGuy"


  3. #2
    Join Date
    Jul 2015
    Posts
    3
    Provided Answers: 1

    Resolved!

    Hi Everyone,

    I figured it out.

    I added an "On Got Focus" event that requery's the "Other Applications" multi-select list. This refreshes the list "live."

    It appears that the "On Click" event occurs when either the "OK" or "Cancel" list box buttons are clicked. "On Got Focus" appears to do the job correctly.

    Also, I needed to specify the "Other Applications" control. I was misunderstanding the info item in Access describing the behavior of leaving the control field blank in the macro. If I leave it blank, i seems it would refresh the "servers" table, not the "Applications" table that the multi-select box was related to.

    Guess I should have help off on posting here for a bit, but I guess the info may help someone else out someday.

    Thanks anyway!
    JDDellGuy

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •