Hi Gustav, I copied your code then pasted it into a new module in a new ACCDB. It doesn't seem to like the first line, beginning with the word Attribute. Do I need to add a reference or something? TIA.