Thank you for your reply.With the "while" loop I have found it will iterate through the records remove the buttons and save the form but does not stop at the last record, it wants to continue and the following error message appears in the console.GeneralError: Operation failed.XFAObject.next:28:XFA:...