[AccessD] Eval function

Hale, Jim Jim.Hale at FleetPride.com
Tue Jun 21 16:21:50 CDT 2005


Interesting. Does it work in mdes? I ask because the article says "for a
function like Eval to work its magic, your application execution environment
must have access to the language's interpreter. Because Access is
distributed with the VBA interpreter we get to use the Eval function." But
since mdes are already compiled how can it work?
Jim

-----Original Message-----
From: Steve Capistrant [mailto:scapistrant at symphonyinfo.com]
Sent: Tuesday, June 21, 2005 3:49 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Eval function


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





-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list