Thanks Andy for your response. Though it took me a while, I finally understood what was wrong with my code.
Asha