Listbox Update

  • Thread starter Thread starter yanguo
  • Start date Start date
Y

yanguo

I have a subform used as edit for data selected on a listbox in main form.
The data is displayed on subform when I select one record from listbox. Data
changes are saved when I select another record from listbox. But the values
displayed on listbox is not refreshed untill I click on another button on
main form to repopolate data into the listbox. I hope that whenever data in
the subform is saved it automatically refresh the listbox in the main form to
reflect the change. I try not to reload the whole recordset for listbox
everytime but don't know if that's doable.

Any suggestons? Thanks!
 
Try using the AfterUpdate event of the subform to requery the list box:

Me.Parent.MyListBox.Requery
 
I tried that in subform.afterupdate(), in mylist.click() and a few other
plces but it doesn't make the list to refresh.
 
Then there is some other problem you haven't found. The last thing to try is
with the form open. Open the VBA editor and requery it in the immediate
window. If that doesn't work, then there is some hidden problem you will
have to chase down.
 
I have occasionally found that a ListBox on a Parent form simply refuses to
requery from the SubForm. Usually this has worked for me from the subform:
- Save the SubForm record
- Me.Parent.Recalc
- Me.Parent.MyListBox.Requery
Don't ask me why the problem occurs, nor why the above steps (usually) work!

Tim D
 
Back
Top