William Benson
vbacreations at gmail.com
Fri Jan 27 20:48:06 CST 2012
I have sometimes put proc names in a table. Run the code required for a particular value from a group of records selected from the table. I also added refernce to vba extensibility to the project so that I could loop vbe components to verify that " "& procname & ")" could be found in the code project. I was just kinda playing around- no real advantage - but I enjoyed selecting a list of required procs in a recordset according to some parameters then looping the recordset to call the needed functions in required sequence, by name using either evaluate() or application.run On Jan 27, 2012 8:50 PM, "Stuart McLachlan" <stuart at lexacorp.com.pg> wrote: > I would consider this much easier to follow. It encapsulates the > conditional in it's own Sub > and it is a simple Copy/Paste of two lines followed by a minor edit each > time you add a new > report: > > Sub CommonCode(rptname as String) > 'Do common stuff > ..... > 'Do specific Stuff > Call SpecificCode(rptname) > 'Do more common stuff > ..... > End Sub > > Sub SpecificCode(rptName as String) > Select Case rptName > Case "rptOne" > Call rptOne_CompoundFilters > Case "rptTwo" > Call rptTwo_CompoundFilters > Case "rptThree" > Call rptThree_CompoundFilters > Case "rptFour" > Call rptFour_CompoundFilters > End Select > End Sub > > > On 27 Jan 2012 at 19:13, Brad Marks wrote: > > > > > I have written a number of small chunks of VBA code to support > > "Compound Dynamic Report Filters". Much of the code is "Common" code, > > but some of the code needs to be customized slightly for each Report. > > > > In the "common" code that calls the "Specialized" code, I current use > > IF statements to call the proper sub. This will require one IF > > statement for each report (someday we might have 50+ reports) > > > > By being able to use a variable in the VBA CALL statement, we will be > > able to have just a few lines of code, instead of all the code needed > > to support 50+ different reports. > > -- > Stuart McLachlan > > Ph: +675 340 4392 > Mob: +675 7100 2028 > Web: http://www.lexacorp.com.pg > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >