That is simpler and does solve the error - thank you wysota.

However, I would still like to know what the problem was with my origional code that would cause it not to compile so I can understand it better.