Creating a QueryDef if columns are dynamically chosen.
Suppose I have a table X with columns a1, a2, a3, a4. There is a form with checkboxes b1, b2, b3, b4. The user can select any combination of these boxes. I need to write the VBA code for a button that will form the SELECT statement which selects those corresponding columns, i.e. if b1 is checked then a1 is in the SELECT clause otherwise it is not and so on.
What would be the most straight forward way to do this?
Actually it's a virtual table from a join of six other tables with many fields to chose from. I will use QueryDef and TransferSpreadsheet to an Excel spreadsheet.
Last edited by nyodn; April 19th, 2010 at 03:48 PM..
Reason: I hit the return button inadvertently before I completed my question.
|