I've done some work (untested as yet) in the direction you ask for. Here it is. I'm sorry to be unable to even perform the first basic syntax check on this. I'm currently quite busy with an important customer and I don't know when I'll be able to correct unavoidable cust&paste basic errors in the code provided. I apologize for that inconvenience. Only try and carefully check with sample DB, not production (if ever it passes syntax check!). I sincerely hope you can fix typos and basic errors