I did what you suggested and the same problem happened once I'd loaded the ActiveX Data Objects reference into the project. This was an old version (2.1). When I replaced it with latest version (6.0) it compiled. I did the same on my application and it also compiled. So that seems to have solved the problem.
Thanks for your help.