Can you use a variable with "Search" in a formular?

I am trying to search an error result that I have populated to a vairable called Error.  I want to serach the error string for the word "locked".  When I try to use this in a formular the editor respond with an error saying Invalid formula: #value.

The formula looks like this:

SEARCH( "a" , Error , 1 )

If I change the formula to be:

​SEARCH( "a" , "Error" , 1 )

​I do not get the error but I assume this to be looking for "a" in the string "Error" which would be fairly piontless.  Am I looking at this the wrong way?

(1) Answer