Hiding columns in a table via scripts
I have a database that I am working on that has a large amount of data of different types. I have a start screen that allows the user to choose which type of data they would like to see. The client wants to set it up so that they can select multiple data-types and view them in a single spreadsheet, which isn't a problem. There is already a table that has all 8 of the data sections displayed. I also have a list layout that mimics the table layout (ie, a single line with pertinent data and the column names in the heading).
What I need is an automated way to only display the columns for the data types they select, and hide the other columns. From what I've read in these forums the typical solution is to create multiple layouts with some displaying certain data, but I would like to avoid the 40 something layouts that would need to be created for that to work.
So...in short, is there a way to script entering the modify window of a table and then turning off/on certain columns?