Sorted! (well, it works at least!)
SJ, Peter,
Thanks for all your help. I have put together something that works. I'll paste the code below so you can have a look at it.
I ended up ditching the parameters and replaced them with functions. The functions return date values that are set when the...