That was it. I had renamed a flag in TMG from '1841 Census' to '1841 UK Census'.
I suddenly had the thought last night in bed but by that time I had already switched of the PC, and could not try it until the morning. It has now fixed the problem.
Thank you very much.