Your simplified version worked fine - thank you - your deduction
regarding the quoting seems to have been correct. Apologies for not
replying earlier but BT (who seem to own our wan) decided to block
everything but 'web' from our site and it has taken until now to get
smtp and pop reinstated.
Thanks to all for your help - I can now carry on with the project in hand
(which has about 45 variables and needs to be queryable via a web
interface - fun times - only limited by the fact that this is not my
day job)
Thanks again,
Francesco