Hide table columns

User avatar
Michael Abrams
4StarLounger
Posts: 579
Joined: 10 Feb 2010, 17:32

Hide table columns

Post by Michael Abrams »

Is there a way to open a table (using a button on a form) with only certain columns visible ?

Thank you.

MIchael

User avatar
HansV
Administrator
Posts: 78592
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Hide table columns

Post by HansV »

I'd never open a table directly, but create a form based on the table, and open that. In a form, you get to decide which fields are displayed and which ones aren't.
Best wishes,
Hans

User avatar
Michael Abrams
4StarLounger
Posts: 579
Joined: 10 Feb 2010, 17:32

Re: Hide table columns

Post by Michael Abrams »

The users actual work out of the tables directly (long story - but it is OK that they do that)

Their issue is, the tables have 50+ columns, and they need to use about 10 of them. So they wind up "hiding" the columns they don't need.

They use these tables all day - I have 100s of databases that this occurs in,

They want to be able to open the table (s) with just the fields they need.

I actually have 100's of tables like this. These tables are used for research.

Michael

Dashiell
NewLounger
Posts: 5
Joined: 19 Mar 2014, 19:35

Re: Hide table columns

Post by Dashiell »

You could set-up queries with the correct columns included and then attach the query to the button.

User avatar
HansV
Administrator
Posts: 78592
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Hide table columns

Post by HansV »

The problem is that hiding columns in a table counts as a design change. In general, it is not a good idea to let end users apply design changes.

In a datasheet form, you can show/hide columns dynamically - controls on a form have a property ColumnHidden that determines whether the field they're bound to is displayed in DataSheet view.
Best wishes,
Hans

User avatar
Michael Abrams
4StarLounger
Posts: 579
Joined: 10 Feb 2010, 17:32

Re: Hide table columns

Post by Michael Abrams »

Dashiell wrote:You could set-up queries with the correct columns included and then attach the query to the button.
Of course !

Thanks Dashiell.

User avatar
Michael Abrams
4StarLounger
Posts: 579
Joined: 10 Feb 2010, 17:32

Re: Hide table columns

Post by Michael Abrams »

HansV wrote:The problem is that hiding columns in a table counts as a design change. In general, it is not a good idea to let end users apply design changes.

In a datasheet form, you can show/hide columns dynamically - controls on a form have a property ColumnHidden that determines whether the field they're bound to is displayed in DataSheet view.
I know, but it is how the process is set up.

I will look into the ColumnHidden property.

What I will want to set up eventually, is to have a list box displaying the tablenames in the database and allowing the user to select the table
and open THAT table with specific columns hidden.

That's later though.

Thanks HansV!

User avatar
HansV
Administrator
Posts: 78592
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Hide table columns

Post by HansV »

See what you think of the attached sample database. If you allow macros, it should display a form on which you can select a table, then select fields from that table, and open a form with just those fields.
SelectFields.zip
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
Michael Abrams
4StarLounger
Posts: 579
Joined: 10 Feb 2010, 17:32

Re: Hide table columns

Post by Michael Abrams »

That is unbelievable ! How in the heck do you do it?

Not just brilliant, but quick - you are just a miracle.

Thank you HansV - of course exactly what we needed !!

Thank you so much !!

MIchael