Steve Capistrant
scapistrant at symphonyinfo.com
Tue Jun 21 15:49:19 CDT 2005
The EVAL function is indispensable for calling function procedures whose names are stored on tables. For example, in our applications, we maintain a central table named "Output", which is a list of all reports, export function, etc., making it very easy to present a list of outputs on a searchable screen, or to use them dynamically in menu structures. Every output requires that you first open a certain "launchpad" form to enter parameters (date range, font size, sort order, etc). We have a function written that opens this launchpad. The outputs table stores the function name -- e.g. "SetupLabels()" -- in a field named "TargetProcedure". Once the user chooses that output, your code needs to grab that function name and run it. That's where the EVAL() function comes in. Use code like this: ------- Public Function RunOutput(lngOutputID As Long) As Boolean Dim strProc As String strX = "Select * from Output WHERE OutputID = " & lngOutputID Set rs = db.OpenRecordset(strX, dbOpenDynaset, dbSeeChanges) strProc = rs!TargetProcedure Eval (strProc) --------- The only odd thing is that the function name as stored in the table MUST include parentheses, even if there are no parameters specified. Steve Capistrant scapistrant at symphonyinfo.com Symphony Information Services 7308 Aspen Lane North, Suite 132 Brooklyn Park, MN 55428 763-391-7400 www.symphonyinfo.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Michael R Mattys Sent: Tuesday, June 21, 2005 3:31 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Eval function ----- Original Message ----- From: "Hale, Jim" <Jim.Hale at fleetpride.com> To: "'Accessd (E-mail)" <accessd at databaseadvisors.com> Sent: Tuesday, June 21, 2005 3:04 PM Subject: [AccessD] Eval function > Okay, since it is quiet maybe we can start a discussion about the Eval() > function. The article I just finished reading says "The Eval function lets > you deliver applications that can create themselves dynamicaly at runtime. > You can build your app code at runtime, pass it to the Eval statement, and > have your dynamically generated line of code processed." Sounds > interesting.Anybody use it? > Jim Hale Jim, What else does this article say? Why do I need the eval function if I've already written the code to create a form, controls, CBF etc? ---- Michael R. Mattys Mattys MapLib for Microsoft MapPoint http://www.mattysconsulting.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com