Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012

    Unanswered: Access 2010 Button to Hide/Show Fields In Subform

    Hello Everyone, and thanks for any help you can provide.

    I have a main (single) form with a datasheet subform, I know I can hide/unhide columns by right clicking on the columns in the subform, but would prefer to have a button on my main form that will do that for the subform. How can I create a button that when clicked in the header of the main form will give me the same options I get when right clicking to hide or unhide available columns in the subform?



  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    To hide a column on a form in Datasheet view, you use:
    <Control name>.ColumnHidden = True
    and to show (un-hide) it:
    <Control name>.ColumnHidden = False
    If you want to hide a control in a subform from the parent form, you use:
    Me.Controls("Name of the SubForm control").Form.Controls("Name of the control on the SubForm").ColumnHidden = True
    Be aware that the name of the SubForm control can be different from the name of the SubForm.
    Have a nice day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts