Problem with Eval() function

Discussion created by neilwebber on Jan 9, 2012
Latest reply on Jan 12, 2012 by neilwebber
I wonder if someone can point out where I'm going wrong here.
I'm trying to use the Eval() function from Microsoft Access in Arc9.3 vba environment.
I have a brand new mxd with the Microsoft Access object library referenced and all functions are in a standard module. A simple test as follows, as per the msdn example (and what works in Access):

Public Function SHLtest()
Dim fncXXX As String
fncXXX = "fncTest()"
Eval (fncXXX)
End Function

Public Function fncTest()
MsgBox "fncTest"
fncTest = True
End Function

This does not work - get Runtime error 2425 (function name can't be found)

However, the below does work, where the function name is just passed in without any quotes etc (i.e. it looks like a variable name but is treated as a string):

Public Function SHLtest() '''works
Eval (fncTest)
End Function

Public Function fncTest()
MsgBox "fncTest"
fncTest = true
End Function

Does the Eval() just not work this way in Arcmap vba, or have  I fundamentally misunderstood something, made a dumb error etc?

As an aside, I want to use the Eval function to call procedures where the procedure name is a variable. A user interaction results in a procedure name (and parameters) being passed in from an Access table and I then want that procedure to be executed via the Eval function. Maybe someone can suggest a better way
many thanks