Choose columns interactively

B

Brian

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.
 
J

John Vinson

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!
 
B

Brian

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top