Many thanks, I move the code on the insert page to the top of the page, but still got an error. I then noticed that all other dataassist pages had the same problem. So I move the lines to the top on all the other pages like the results page and all works fine.
Thanks again for you help with this.