Paul,
this is (at least?) the third
thread you open about your not-working-properly-code.
Just stick to one thread. Let us know what you did with all the advises given to you, what you did to
test your results and what efforts you made trying to find out what was causing the problem.
The way you do it now shows no respect to all the people who tried to help, in my view. You just present us with code, and then simply ask us what's wrong with it.
Greetings,
Piet