Custom Sub On Form For Event

  • Thread starter Thread starter Joseph Misko
  • Start date Start date
J

Joseph Misko

Hello! I have created a custom sub that I want to set for the OnClick event
of several buttons on my form. I don't want to have to define so many event
Subs just to have them each contain a call to my Sub. My Sub is named
FindIt and I have tried setting the event property to: FindIt, FindIt(),
=FindIt, and =FindIt().

I believe there is a way, any hints?

Thanks 100x,
Joe
 
you can create that sub findit() in a module and call it from your
button_onclick.
it works the same way.
 
Put your sub in a module under the Modules tab in the database window and
call it with =FindIt().

BTW, your sub should look like:
Sub FindIt()
<Your Code>
End Sub


PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com
 
Hello! I have created a custom sub that I want to set for the OnClick event
of several buttons on my form. I don't want to have to define so many event
Subs just to have them each contain a call to my Sub. My Sub is named
FindIt and I have tried setting the event property to: FindIt, FindIt(),
=FindIt, and =FindIt().

Make it a Function instead of a Sub and use the last of these options.

John W. Vinson[MVP]
 
Totally GREAT !!! This is exactly what I wanted. I thought I had seen this
before, but just couldn't get it. You saved me a bunch of work.

Thanks again,
Joe
 
Back
Top