Thanks for your help on this. I'm glad that is solved.
I have made the changes to the code as you suggested and ´resolved the issue.
The latest code can be downloaded from the LAMS repository.
Thanks again Rob.
Any other comments, bugs or suggestions always welcome.
Ernie