Dear arnelgp,
Please find attached my db if you could get the opportunity to adapt your recommendation to have the temp table and function to get the seq DocID.
I know it's too hard for me to implement your suggestion.
I am sorry to request this from you, but you get time please do it for me...