That means there is something dodgy in the criteria of your query, not the function.
Can you copy and paste the entire SQL from your query - no editing?
Ok fixed it was because some of the data did not have a postcode so blank record fixed thanks for your help