Listbox Update

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!
 
K

Klatuu

Try using the AfterUpdate event of the subform to requery the list box:

Me.Parent.MyListBox.Requery
 
Y

yanguo

I tried that in subform.afterupdate(), in mylist.click() and a few other
plces but it doesn't make the list to refresh.
 
K

Klatuu

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.
 
T

Tim D

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cancel listbox selection 2
Access Cannot select items in listbox 1
Filter with listbox 11
Subform controlled by a form's listbox 1
Help using 'OnClick' event in ListBox Selection 1
Access MS ACCESS 2007 2
DoCmd and ListBox events 2
Listbox limit 2

Top