Brad Marks
BradM at blackforestltd.com
Fri Jan 27 15:51:54 CST 2012
All, Thanks for the assistance. The “Application.Run” approach works nicely. I have never used “Eval” before. Here is my test code. This does not work. I must be missing something. ‘~~~~~~~~~~~~~~~ Sub Sub_1() Call Eval("Sub_2") End Sub ‘~~~~~~~~~~~~~~~~ Sub Sub_2() MsgBox "Now in Sub_2" End Sub ‘~~~~~~~~~~~~~~~~~ Thanks again for the help. Brad ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil Sent: Friday, January 27, 2012 3:27 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Is it Possible to Have a Variable in a VBA "CALL" Statement? Hi Brad -- You can consider one of the three options: 1. Function Eval(StringExpr As String) Member of Access.Application 2 Function Run(Procedure As String, [Arg1], [Arg2], [Arg3], [Arg4], [Arg5], [Arg6], [Arg7], [Arg8], [Arg9], [Arg10], [Arg11], [Arg12], [Arg13], [Arg14], [Arg15], [Arg16], [Arg17], [Arg18], [Arg19], [Arg20], [Arg21], [Arg22], [Arg23], [Arg24], [Arg25], [Arg26], [Arg27], [Arg28], [Arg29], [Arg30]) Member of Access.Application 3. Function CallByName(Object As Object, ProcName As String, CallType As VbCallType, Args() As Variant) Member of VBA.Interaction Thank you. -- Shamil 28 января 2012, 00:23 от "Brad Marks" <BradM at blackforestltd.com>: > All, > > I am experimenting with building a generic routine that will in turn > call other routines based on a variable. > > The following statement works nicely of course. > > Call Report100_Compound_Filters > > However, I would like to able to do something like shown below so that I > can plug in the first part of the name (such as "Report100") > > DIM MySub as String > > Dim MyReport as String > > MyReport = "Report100" > > MySub = MyReport & "_Compound_Filters" > > CALL MySub > > ~~~~~~~~~~~~~~~~~~~~~ > > This CALL does not work, but I thought that perhaps there is some sort > of method to accomplish this with VBA. > > Thanks, > > Brad > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.