1
votes

I've created a form in MS Access 2010 using an unbound combo box to select table entries by names and a popup form to insert new entries to the database. As the combo box does not update on it's own, I've tried forcing an update with Forms![main_form].[unbound_cmb].Requery and Forms![main_form].Form.Refresh/Requery in the popup form "save" button OnClick event but none of the three approaches works.

So how can I update the combo box after adding a new record/clicking the "save" button?

1
Not 100% sure about this, but when you open the popup form, the form with the combobox loses focus. Could you add a "Form_GotFocus" event on the main form that requeries the records for the combobox? Or you could have a timer that checks to see if the popup has closed... but you should be able to requery the combobox on close. Hopefully someone will provide a better solution...Wayne G. Dunn
After changing the order of macro commands from mod_update() (my VBA function) and closing the popup to close and mod_update(), the combo box does update, but selecting the new record does not update the form whilst selecting old entries doesJohannes Trümpelmann

1 Answers

0
votes

Johannes,

What are you using to populate the combo box? a table or a query?

Also, I'm not sure if you need to requery here. I use the VBA Command.Requery to update cascading combo boxes in the After Update event.

I have a similar database used to register people for examination sites. I have a popup form for data entry, a pop up for new testing sites, and a form that uses two unbound combos to filter a report. Both of my combos are self updating and I accomplished this by using queries.

// EDIT You are going to want to read this*************
A little more about Command.Requery, Requery is used when you need to run the query again, usually against a different key in your query. While it may seem like it is working sometimes, it is probably only working because either Access is automatically refreshing the query by timer, or because you are causing a refresh by closing the form. The problem you are having is caused by your query not being refreshed, not because it is not requerying properly.

See my comment below for a simple work around this problem. If, for some reason, you need to always have the form with the combo selection open, then try to have a refresh command on your save button. However, I strongly suggest you follow the method in my comment, as it has been working for me with out any issues.