Since this all revolves around one FORM variable why not place the table name in the value that gets passed from the "tablename" value?
So then all you would ahve to do is:
tableName = Request.Form("tableName") and eliminate the need for convoluted code.
================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========