I now check the values of the arguments before calling the function. That has resolved my problem. Thanks for your help.