What kind of data type can "Eval()" function return? User defined type okay?

----------------
Type MyType
reading as single
result as boolean
End Type
----------------
Function MyFunc (one as ....) As MyType
MyFunc.reading = 1
MyFunc.result = false
End Function
----------------
Dim TmpType as MyType

TmpType = Eval("MyFunc(1...)")
----------------

IS THIS POSSIBLE?

I try to do this without trying to fetch the return value
----------------
Eval("MyFunc(1...)")
----------------
And my MDB just crash with error "Memory ??"

While I cant actually do?
----------------
TmpType = Eval("MyFunc(1...)")
----------------
There are some error messages.
[697 byte] By [leesing2k3] at [2007-11-19 7:28:43]
# 1 Re: What kind of data type can "Eval()" function return? User defined type okay?
You can use the Eval function to evaluate an expression that results in a text string or a numeric value.

You can construct a string and then pass it to the Eval function as if the string were an actual expression. The Eval function evaluates the string expression and returns its value. For example, Eval("1 + 1") returns 2.

So no - your function returns a UTD - to use eval it must return string or numeric...
Dmorley at 2007-11-9 20:44:36 >
# 2 Re: What kind of data type can "Eval()" function return? User defined type okay?
Thanks mate.

Is there anything I can do to make my code above possible?

Call function by string?
leesing2k3 at 2007-11-9 20:45:37 >
# 3 Re: What kind of data type can "Eval()" function return? User defined type okay?
The manner you have described your problem, it seems you need a class rather than an Eval function.
aio at 2007-11-9 20:46:30 >
# 4 Re: What kind of data type can "Eval()" function return? User defined type okay?
I don't know anything about the Eval Function, but if it returns a string, you can create a delimited string from your UDT in the MyFunc Function, then do a Split with the string returned by Eval.

Function MyFunc (one as ....) As String

'Comma-delimited
MyFunc = "1" & "," & "False"

End Function

----------------

Dim TmpType as MyType
Dim tmpArray() as String

'Split on comma
tmpArray = Split(Eval("MyFunc(1...)"),",")

MyType.reading = CSng(tmpArray(0))
MyType.result = CBool(tmpArray(1))
malleyo at 2007-11-9 20:47:35 >
# 5 Re: What kind of data type can "Eval()" function return? User defined type okay?
IS THIS POSSIBLE?

Function MyFunc (ByRef Result As Single) As Boolean
Result = 1
MyFunc = false
End Function
----------------
Dim TmpBoo as Boolean
Dim TmpSin as Single

TmpBoo = Eval("MyFunc(TmpSin)")
leesing2k3 at 2007-11-9 20:48:40 >
# 6 Re: What kind of data type can "Eval()" function return? User defined type okay?
Bump...
leesing2k3 at 2007-11-9 20:49:39 >