Sub Form Requery

G

Guest

I have a main form with a combo box on it called cboIncident. I also have a
listbox on the form called "trainee" that is populated by a query. I want
the listbox to requery every time I change the value in the combo box. The
listbox query selects all individuals that have the same Incident ID as the
value from the combo box. Any help would be greatly appreciated. Thanks.
 
J

Jerry Porter

Create an AfterUpdate event procedure for cboIncident as follows:

In the properties window for cboIncident, select the Event called After
Update, click the builder button (...), and select Code Builder.

Enter the following line of code:
Me!trainee.Requery

Jerry
 
G

Guest

Jerry Porters suggestion did not work. It either didn't requery or refresh
the listbox to show the new results. Any Other ideas?
 
J

Jerry Porter

Bill,

This is a very common technique, and I've used it quite a lot. If it's
not working, then there's something simple missing in your
implementation or in my understanding of the situation or in my
explanation.

The code window should look something like:

Private Sub cboIncident_AfterUpdate()
Me!trainee.Requery
End Sub

If you're familiar with the Access debugging tools, I would suggest
putting a break point on the line of code with the Requery command.
Then see if it is executing when you change the value in the combo box.

Jerry
 

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


Top