-1

I would like to select specific columns based on the user checkbox selection.

I can able to achieve it using VBA but is it possible to arrive the fields in SQL itself based on forms checkbox tick status?

Sixthsense
  • 1,927
  • 2
  • 16
  • 38

1 Answers1

1

Two ideas:

1) create a text box that collects the values of the checkboxes: = if(checkbox1,"Col1, ","") & if(checkbox2,"Col2, ","") & ... Create a second one that removes the tailing comma. Use the content of this second text box to build your SQL string.

2) Solution 1 requires you to hard code the columns in one formula. A more generic way would be to populate a list with the column names of your data source (the table). The changed event of the list would then generate the list of column names for your SQL string. This solution involves VBA, yes but it's interactive. Guess that's what you're after.

y4cine
  • 396
  • 2
  • 20