Thank you for that it works very well. I thought I might have been able to put it in a query which is where I really wanted it, but after spending time trying, I realise I can’t.
I have attached the database in the hope that I can explain what I need to do now. What I'd really like to achieve...