Thanks, that first code is the way I eventually worked out, but yeah it's horrible. I didn't want to create a whole new class because it seemed so unnecessary for such a simple form. But I guess a new class is the only way to avoid messy hacks.

Thanks for the help.