I'm not sure if I completely understand the question, but If I was going to do something like that with ASP, I would make a two step form that first presented the user with a list of choices of fields to query, and then based on the selections, pass the variables to the second part of the form using a querystring and have that part of the form build the SQL statement.