Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2005

Tip: Looking for answers? Try searching our database.

Custom Sub On Form For Event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joseph Misko - 25 Jan 2005 17:22 GMT
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
ruthness - 25 Jan 2005 18:30 GMT
you can create that sub findit() in a module and call it from your
button_onclick.
it works the same way.

> 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
[quoted text clipped - 6 lines]
> Thanks 100x,
> Joe
PC Datasheet - 25 Jan 2005 19:34 GMT
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
                             resource@pcdatasheet.com
                                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
[quoted text clipped - 6 lines]
> Thanks 100x,
> Joe
John Vinson - 25 Jan 2005 19:45 GMT
>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]    
Joseph Misko - 25 Jan 2005 21:03 GMT
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

>>Hello!  I have created a custom sub that I want to set for the OnClick
>>event
[quoted text clipped - 7 lines]
>
>                  John W. Vinson[MVP]
Joseph Misko - 25 Jan 2005 21:02 GMT
Thanks everyone for your input!

Joe
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.