Eval() syntax problem

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
 
K

Kagsy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top