We help IT Professionals succeed at work.

Passing the MID function as an Argument

upobDaPlaya
upobDaPlaya used Ask the Experts™
on
I assume a Function such as LEFT can not be passed as an Argument for a Function.  Such as
DoSometing(Left([LastName,20))

Thus when I call a function and pass arguments a Function can not be used as an argement even if the result matches the type of the called procedure such as a string variable.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Technology and Business Process Advisor
Most Valuable Expert 2013
Commented:
It depends what DoSomething is, but yes, you can pass function modified data in functions...

Function DoSomething(StringVariable)
   'Do stuff
End Function

DoSomething(Left("StringData", 2))

Should work fine to pass "St"
HuaMin ChenProblem resolver

Commented:
If the argument is input argument, then you can still put Left, Mid to it.
Top Expert 2014

Commented:
DoSometing(Left([LastName,20))
Your example is not passing the Left function to the DoSomething() function. You are passing the result of a Left function invocation.

Author

Commented:
Thanks !