Looks fine and I have deleted the double post. I could not see your program and can you share that with us. Remember do not post it as an attachment but use code blocks in the posts to explain where you think the probable error.
I would you read Hints before you make a post
to help you in posting your queries.