Dynamic If...Then using variables
I am trying to make a "dynamic" If...then statement in VBA to evaluate something like: "If -1 >= 0 Then"
I have a table that contains a field that contains a string like: ">14"
So I do a Dlookup to get that value (vYellow varient) and I want to use it in an If...then like this:
If Eval(strInspType & " " & Eval(vYellow)) Then
MakeColorTransfomer = "Y" 'Yellow
Where strInspType is a number beging past as a string.
When I run it I get this error: "The expression you entered contains invalid syntax"
When strInspType is "-1" and vYellow is "=0"
What I am attempting to do is evaluate a value (strInspType) against whatever the dlookup returns, it will ether be > or < or = to a number. strInspType is being based as a string because the field in the table does not always contain numbers, sometimes words like "none" etc. But if it is a number then I need to compair it with whatever I find in the Dlookup.