I have removed the spaces around the "=" and the code works fine. Using spaces around = is an old habit, but I'll stop doing that in these cases, and watch out for it as potential cause of errors.
Thanks a million to ripat, jojopi and Trev for getting back to me so quickly and for being so helpful.