Have a look at the updated file, I created a temp table (you will need to empty it and re-populate it everytime you need to run the report). Because the autonumbers will be out-of-synch after the delete\append cycles you need to use the ranking query approach to reset them to 1,2,3,... Or you can reset the autonumber seed programmatically after you emptied the temp table, then you can use the autonumber as your TREE_NUMBER: http://allenbrowne.com/func-ADOX.html#ResetSeed
Cheers,