Update list box

K

KateB

I have a form in which I can enter courses being held throughout the year.
However, I also wish to display a list of the courses to make it easy to
switch between them and see the list of attendees (a subform). However, if I
change any information, e.g. date or tutor, the list box doesn't reflect the
change unless I go out and back in. The data source for the list is a query
so I assume I need to get the query to re-run if I change any other fields.
How do I do this?

Many thanks
 
S

scubadiver

try

me.requery

or

me.refresh

in the 'after update' event (or both together).
 
J

John W. Vinson

I have a form in which I can enter courses being held throughout the year.
However, I also wish to display a list of the courses to make it easy to
switch between them and see the list of attendees (a subform). However, if I
change any information, e.g. date or tutor, the list box doesn't reflect the
change unless I go out and back in. The data source for the list is a query
so I assume I need to get the query to re-run if I change any other fields.
How do I do this?

Many thanks

Requery the listbox in the AfterUpdate event of the form which changes the
data: either

Forms!NameOfForm!NameOfListbox.Requery

or, if the listbox is on the same form as you're using to update, just

Me!NameOfListbox.Requery

Choose the Code Builder in the AfterUpdate event and put the proper requery
command between the Sub and End Sub lines.
 

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

Top