Frame_Click event mistakenly invoked when clicking ListBox

J

JohnM77

Scenario:
I have an option button group (unbound) which controls the recordsource
property of a listbox control (for filtering). In the control group's
Frame_Click event, the listbox.recordsource property is set when an
optionbutton is clicked, and then the first row of the resulting recordset is
selected in the listbox as follows:

Private Sub Frame_Click()
ListBox.Selected(0) = True
Call ListBox_Click
End Sub

Problem:
Upon subsequent clicking of the listbox control, the Frame_Click event is
triggered, causing the first row of the listbox to be reselected. The result
is an inability to select anything but the first row of the listbox. My
question is, why does clicking the listbox control invoke the Frame_Click
event? How can I prevent this event from executing when no click is performed?


Many thanks,
John
 
B

Beetle

You should probably be using the After Update event of the
option group (not the Click event).

Is the list box within the boundaries of the option group
border?
 
J

JohnM77

Thanks for your reply. The listbox is outside the frame border. I tried both
the AfterUpdate and BeforeUpdate events with the same result. When I click on
an option, the Frame_[Event] is triggered. Then any subsequent clicking of
rows in the listbox causes the Frame_[Event] to run again, after the
ListBox_Click finishes.
You should probably be using the After Update event of the
option group (not the Click event).

Is the list box within the boundaries of the option group
border?
Scenario:
I have an option button group (unbound) which controls the recordsource
[quoted text clipped - 17 lines]
Many thanks,
John
 
B

Beetle

And there's no code in any of the list box events?
--
_________

Sean Bailey


JohnM77 said:
Thanks for your reply. The listbox is outside the frame border. I tried both
the AfterUpdate and BeforeUpdate events with the same result. When I click on
an option, the Frame_[Event] is triggered. Then any subsequent clicking of
rows in the listbox causes the Frame_[Event] to run again, after the
ListBox_Click finishes.
You should probably be using the After Update event of the
option group (not the Click event).

Is the list box within the boundaries of the option group
border?
Scenario:
I have an option button group (unbound) which controls the recordsource
[quoted text clipped - 17 lines]
Many thanks,
John
 
J

JohnM77 via AccessMonster.com

I do have code in the ListBox_Click event, but the behavior persists even if
I eliminate all ListBox event code.
And there's no code in any of the list box events?
Thanks for your reply. The listbox is outside the frame border. I tried both
the AfterUpdate and BeforeUpdate events with the same result. When I click on
[quoted text clipped - 13 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