If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: Refreshing form data from a sub form

Hi there,

I have a sub form which populates data in a look up table (opened using the ‘Not in list’ event of a combo box on the main parent form). I can refresh the sub form to save the new data but would like to refresh the parent form so that the new data appears in the combo box. Ideally I would like to do this with one click from the sub form. I can’t get the correct code to reference the parent form. Can anyone help?

Thanks for that. That’s basically what I was trying but the combo box is based on a table rather than a query. Is there a non clunky way to reload the table first and display the same record or is it easier just to base the combo box on a query?

whether the combo is based on a query or a table is immaterial. effectively to the combobox a table and query are the same thing (a data source presented in some order). The query allows you to join tables or use some esoteric order, or it allows you to reformat the source data - but intrinsically its the same beastie.

if I'm reading your question right, you have added a new value which 'should' reappear in the combo box on the parent form. if thatsd the case ensuring the new value is written to the backing table for the combo then a requery will pull up that value.

if you want to make sure that optionj is the value in the combo then refresh / requery the combo and set the value to the required item

depends on what you are trying to do,
what you are used to
and what you expect those following in your footsteps to do.

Technically I'd guess you vb macro is probably doiung the same thing as as a simple combobox.requery, but I don't know.

personally I'd use vb/vba over a macro any day, but then thats my background, and my experience, for others docmd may be appropriate. I think its likely that .requery will be more sustainable / supportable over time and different versions of office products.

effectively there is no simple answer. I'd guess most people contributing to this forum will go down the route of a requery, most newbies wil be happier with the docmd.