events not firing??

T

Tieske

here's what I have

a mainform, containing a textbox and a subform, the subform contains
togglebuttons and comboboxes
the subform onload event creates an object (class I designed myself). This
class, after being initialized has variables referencing some of the controls
on the mainform and some on the subform (variables are set OK, because I can
modify the captions from there, that works as expected)

the variables are defined within the class using "WithEvents".

The events for the textbox (keyup event) on the mainform behave as expected,
but the events for the toggle buttons and comboboxes (change and click
events) on the subform don't fire

Does anyone have an explanation for this behaviour? Am I doing something
wrong?

any help is appreciated, thx!.

Tieske

PS. as a workaround I now catch the events in the subform itself and from
there call the (supposed) event handlers in the class. Works, but is a bit
messy because I have to define the handlers as public in the class.
 
T

Tieske

update;

while creating my workaround (see PS below) the events started running
twice. Once called from the event procedure in the subform, my workaround,
and suddenly the events in my class also started behaving as designed.

So in the subform I have now commented out the call to the event procedure
embodied in my class. Leaving and empty event procedure in the subform. And
the event procedure in my class now works perfectly.

concluding; the event in the class only fires if an event procedure (empty
or not) for the same event is present in the subform.

does anyone have an explanation for this behaviour?

regards,
Tieske
 
R

Rod Plastow

Tieske,

I seem to remember encountering this some years ago.

Let me speculate (until some better informed poster supplies the official
answer). The Access Form class raises its own events and your listener/event
handler will hear those form events. However the Form class is itself a
listener for its own Control object events. With no matching event procedure
the Form class does not rebroadcast these events. Hence you need, as a
minimum, to include an empty event procedure to force the Form class to
rebroadcast the Control event.

Rod
 
T

Tieske

Thx! explanation sounds logical, behavior still doesn't make sense.
anyone an official explanation?
 

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