Hide Field/Column in SubForm in Datasheet View

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
72,313
Office Version
  1. 365
Platform
  1. Windows
I have a subform which I am attaching to a main form. The subform is in datasheet view. I would like to "hide" the field (which appears as a column in datasheet view) that is used to link the subform to the main form, as the field is redundant and takes up unnecessary room on the subform view. In the subform, I went to the properties of this field and changed the Visible property to "No", but it still shows up.

Is there some trick to hiding this column when displaying the subform in datasheet view? I don't think I can remove it altogether, as it is my linking field. In the interim, I have moved this field to be the last field to the right on my subform, but I would love to not display it at all.

By the way, I am using Access 2007.

Thanks
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Joe,
I wasn't able to test this in 2007 but in 2002 it worked. I opened a form in datasheet view and right clicked on the column I wanted to hide. It offered a hide selection. I clicked and the column (field) was hidden. Closed the Form and re-opened. Still hidden.

Alan
 
Upvote 0
Bob,

Thanks! That had exactly what I needed. His code is a lot more complex that what I need (he is hiding multiple controls by looping through them), but I gleaned what I need:
Code:
Private Sub Form_Load()
    Me.FieldName.ColumnHidden = True
End Sub
Alan,

Out of curiosity, I looked into your suggestion too. I wasn't seeing the hide option until I right clicked on the column name (instead of a cell in the column). It looks like that might work too. The only question I wonder is how hard it is to un-hide it in the future, if you ever need to (if it is hidden, I am not sure how you would click on it to unhide it!).

Thanks for the help. Good stuff!
 
Upvote 0
Perhaps it's a 2010 thing but I was able to create a linked form/subform setup with the subform being a datasheet with the linked field hidden.:eek:
 
Upvote 0
Just saw the other responses.

To unhide just right click and select Unhide, you should get list of all the fields with checboxes for hide/unhide.
 
Upvote 0
Joe,
Just got back. Norie has the answer. Right click.

Alan
 
Upvote 0
Good to know. Thanks everyone!
 
Upvote 0
Joe,
Just got back. Norie has the answer. Right click.

Alan

The simplest by far. One other way would be to provide a button on the Ribbon to iterate through the fields and ensure that all of the ColumnHidden are set to False.
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,963
Members
449,200
Latest member
indiansth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top