in reply to Error - Global variable ....
could you post your code? so that it is for us to explain the things better.