Just looking at your code, without actually trying it, my guess would be that it is because you didn't put the layer name triCode in quotes.
if (currentLayer.source.name == triCode)
if (currentLayer.source.name == "triCode")
your way would make all of the results false, because their is no variable named triCode .... and that's what it would be referencing without quotes.
Give that a try and let me know if it works.
Thanks for the help Elaine,
I actually just figured it out. I was going at it all backwards. I was trying to control from Comp A the properties on multiple layers in Comp B. I instead I put this code in the opacity of all the layers in Comp B:
if (comp("changeName").layer("triCode").text.sourceText == thisLayer.source.name)
transform.opacity = 100;
transform.opacity = 0;
Now if the sourceText in Comp A changes the layers in Comp B compare their values to it's value and change accordingly.