Access Query: dynamically show/hide columns

F

Foo

I am looking for a way to let a user specify which columns in a query
result are shown and which are not.
What I have is a query with a lot of columns. I want to make a form
with checkboxes where a user can select (by checking/unchecking
checkboxes) which columns to show/hide in the displayed query. After
clicking an Open Query button the query has to be shown in which only
those columns are visible that the user has specified. So, basically
just what the 'Show column' property of a query does, but now
dynamically defined instead of defined in the query itself. Is
something like this possible in Access? Or do I have to manually write
a complete SQL string depending on which checkboxes are selected in the
form? Thanks in advance.
 
C

CyberDwarf

Foo

a - Yes, you could dynamically construct the query string, or

b - you might want to make the fields Visible/notVisible on you form or
report

IMHO, you might find possibility 'b' very messy (layout problems). 'a' may
be time consuming to code, but it is easier to construct and maintain

HTH

Steve
 
F

Foo

I have tried method B, but the problem is that I am using a Datasheet
form. When I am using a default Single form it is no problem to set the
visibility of a field to false. But doing this for a datasheet it makes
no sense: all of the query columns are displayed, no matter if you set
the visibility to false...

Well, maybe I have to try method A then.... :)

CyberDwarf schreef:
 
F

Foo

Ok, just found that there was a columnhidden property for the datasheet
form:

FormName.Controls("ColumnName").ColumnHidden = True

That should do the trick! Thanks for your input!
 

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