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 / Modules / DAO / VBA / May 2005

Tip: Looking for answers? Try searching our database.

Run a sub-routine using a string variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ross - 03 May 2005 17:19 GMT
How can I build a string variable and use its name to run a sub-routine.

For Exapample:

strProcess = "Run_Process_" & strDB

strDB = DB2
Subroutine name = Run_Process_DB2()

Your help is appreciated.

Ross
'69 Camaro - 03 May 2005 18:50 GMT
Hi, Ross.

> How can I build a string variable and use its name to run a sub-routine.

Use the CallByName( ) function for a procedure in a form's module or use the
Application.Run( ) function for a public function in a standard module.  For
example:

   CallByName Me, strProcess, VbMethod         ' Run sub in form or report.
   Application.Run strProcess                          ' Run sub in module.

The called procedure must be public, not private, even if it's called from
the same form.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses:  known newsgroup E-mail harvesters
for spammers are Ripley@CASInternet.Net and scott@ripleysoftware.com

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions.  Remember that the first and
best answers are often given to those who have a history of rewarding the
contributors who have taken the time to answer questions correctly.

> How can I build a string variable and use its name to run a sub-routine.
>
[quoted text clipped - 8 lines]
>
> Ross
Ross - 03 May 2005 20:25 GMT
Gunny (69 Camaro):

Many Thanks.  This is PERFECT!

Ross

> Hi, Ross.
>
[quoted text clipped - 42 lines]
> >
> > Ross
'69 Camaro - 03 May 2005 20:53 GMT
You're welcome!  Glad it helped.

Please consider helping others who have the same question by signing in to
the Microsoft Online Community and marking my earlier post as the answer to
your question.  That way, others who have the same question can search the
database for answered questions and instantly find it, without having to post
the same question you did and then wait around for hours or days until
someone answers it.

Thanks!

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses:  known newsgroup E-mail harvesters
for spammers are Ripley@CASInternet.Net and scott@ripleysoftware.com

> Gunny (69 Camaro):
>
[quoted text clipped - 48 lines]
> > >
> > > Ross
 
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.