Choose columns interactively

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to give users a way to choose which columns are displayed in query results. I started by setting up checkboxes on the form that calls the query, but I cannot figure out how to tie the "Show" property of the field/column to the content of the checkbox. I am looking for a place to put something like this: "If Not CheckboxA then ColumnA.Show = False" but cannot figure out how to apply this to the properties of field "A" in the query.
 
I want to give users a way to choose which columns are displayed in query results. I started by setting up checkboxes on the form that calls the query, but I cannot figure out how to tie the "Show" property of the field/column to the content of the checkbox. I am looking for a place to put something like this: "If Not CheckboxA then ColumnA.Show = False" but cannot figure out how to apply this to the properties of field "A" in the query.

The only way I can think of to do this would be to write VBA code to
poll through the controls on your Form and construct the SQL of the
query on the fly, including the desired fields in the query's SELECT
clause. The query grid isn't going to be useful here!
 
Thank you.

Now, how do I run a SELECT query from VBA? I tried the DoCmd.RunSQL, but it does not appear to allow me to run anything but action queries, and I need only a select query (I would rather not use a make-table query unless it is the only option)
 
Back
Top