Evaluate function

A

avi

Hello,

In an Evaluate statement I use a variable (MyVar) im the middle of the
function, something like

ddd= Evaluate("expression 1" & MyVar & "expression 2")

When MyVar is not numeric I use

ddd= Evaluate("expression 1" & Chr(34) & MyVar & Chr(34) &
"expression 2")

I look for a way to use one Evaluate statement only , both for numeric
and non numeric ddd instead of 2 statements with IF


Thanks a lot
Avi
 
J

JE McGimpsey

One way:

ddd = Evaluate("expression 1" & _
Iif(IsNumeric(MyVar),MyVar, Chr(34) & MyVar & Chr(34)) & _
"expression 2")
 

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