Hi Jason,
Figured it out, it was because one of the rows in my subcategory recordset had a blank foreign key which was meant to link to the parent category recordset. Deleted that row and it now works.
KP
P.S: Instead of moving the code for the dynamic array from one place to another as a workaround, it's easier just to detach the page from the template and than reapply the template to the page if required.