Eval() syntax problem

  • Thread starter Thread starter Winnetou
  • Start date Start date
W

Winnetou

Hi,

I am using Eval() to call a public function fTest() located in form
module frmTest.

The following code runs fTest() only once:
Call Eval(Chr$(34) & Forms("frmTest").fTest("aaa") & Chr$(34)) 'Once

When I add string identifiers to the code, fTest is called twice:
strfrm = "frmTest": strArg = "aaa"
strTmp = "Forms(" & Chr$(34) & strfrm & Chr$(34) & ").fTest(" &
Chr$(34) & strArg & Chr$(34) & ")"
Call Eval(strTmp) 'Twice

Where
Public Function fTest(X)
Beep: Debug.Print CStr(X)
End Function

I don't understand what causes the function to be run twice in the
second case. Thanks for any suggestions.

Mark
 
Mark

I can only imagine it is because you are referring to an
object, i.e. subForm in the Eval string which needs to be
evaluated. Does it run twice if you set the value of the
form control to a variable?

Kagsy
 
Back
Top