Update list box based on state of check box (1 Viewer)

bwyrwitzke

Registered User.
Local time
Today, 15:12
Joined
Nov 11, 2002
Messages
50
This is similar to a question posted by Kevin S in October but I'm using Check Boxes rather than a combo box

BACKGROUND: The Form has two sections. One side consists of 7 check boxes and the other side is a listbox. Each time a check box is checked, a requery occurs, updating the records that match the checks. The other side of the form is a list box that is based on the query created with the check boxes.

GOAL: Update the list box everytime a box is checked, without prompting the user to click a command button

WHAT'S REALLY HAPPENING: The list box never changes. It always shows the entire list. To ensure that the query is updating, after every event, I have an additonal dialog box open with the same list box, and it updates as expected. However, the added dialog box does not update on the fly, I have to close it and reopen it for the list to be updated

QUESTION: How do I update the list box without prompting the user or opening a new form? I've tried me.listbox.requery just about everywhere. Is there another command to refresh?

Thanks.

Bruce
 

edtab

Registered User.
Local time
Today, 15:12
Joined
Mar 30, 2002
Messages
257
In the AfterUpdate event of your CheckBox, try placing the following code:

If Me.CheckboxName.Value = -1 then
Me.ListBoxName.Requery
End If

Substitute the name of your CheckBoxName and ListBoxName accordingly after the "Me."

This should work.

edtab
 

bwyrwitzke

Registered User.
Local time
Today, 15:12
Joined
Nov 11, 2002
Messages
50
Thanks edtab. That's actiually what I was doing. My problem was the location of the statement. I was aksing for a requery, before I went through my subroutine to to modify the query. What a knucklehead! Thanks again for your help!

Bruce
 

Users who are viewing this thread

Top Bottom