WithEvents and the Click event

J

johnb

Hi All
How do I capture any Click or Double Click events that are triggered on a
From? If so do I do it?

I have many controls on my form and it seems a real chore to set up click
and dblClick events for each control.

TIA
johnb
 
A

Albert D. Kallal

johnb said:
Hi All
How do I capture any Click or Double Click events that are triggered on a
From? If so do I do it?

I have many controls on my form and it seems a real chore to set up click
and dblClick events for each control.

TIA
johnb

Even if you could use with events to sink the events into another piece of
code, the with events forces you to define a variable/event for each button
anyway in code. In fact, I've always found that using "with events" actually
produces more code when your trying to sink events from one for to code
anway. furthermore with events is not appropriate will help in your case
anyway.

what you can do is define a public function in your formed that say the ten
buttons or controls that you want a run this code

eg:

Public MyClickFor10buttions

bla bla bal

end fucntion

than what you do with the form in design mode, is you highlight all of the
ten controls at same time, make sure the property sheet is open, and in the
on click event you can simply type in the name of the function
eg:

=MyClickFor10Buttions

Volia...huge now just set the function for the click event for ten controls
all in one shot, and you've got had to open up the code editor ten times in
a row, and if not even had to make ten code stops that would call your code
(eg:, you do NOT have to go


Public Funciton click10

MyClickFor10Buttions


In visual basic they have something that's called a control ray, and it lets
you blind "many" controls to the same event code, while we don't have that
ability in MS access, the above technique and approach will get you by.....
 

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