in reply to why this code doesnt work?

You ought to have gotten an error message that explains why.