Let's try this ...

Can you just post the whole code so there isn't any confusion here ... there are a lot of ways to use this code and it seems to me either you are in the wrong place or the code is off a bit ...