Solved

Show/Hide Columns in Subform

Posted on 2014-04-14
3
564 Views
Last Modified: 2014-04-14
This is probably something mind-blowingly simple (or so I hope) but my brain is fried right now and I'm asking for an assist...

Have three forms:
FormS1
FormW1
FormSub

FormSub is a form subform in BOTH FormS1 and FormW1.  

In FormS1, I need ALL fields of FormSub displayed in a Datasheet view.
In FormW1, I need TWO fields of FormSub HIDDEN in the datasheet view.

How do I either:
Detect which form is the parent from FormSub (then I can easily use ColumnHidden = True/False)
*OR*
Set the fields' ColumnHidden value in FormSub to True/False FROM the parent form.

I cannot seem to figure out how to reference the form!  I would have thought Form!FormSub.Field.ColumnHidden = True or Me!FormSub.Field.ColumnHidden = True but that doesn't seem to be working for me...

your assistance is greatly appreciated.
0
Comment
Question by:Lee W, MVP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 500 total points
ID: 39998425
I think it is
Form!formName!SubformName.Form!columnName.ColumnHidden = True (if it will allow that to happen)

Kelvin
0
 
LVL 95

Author Closing Comment

by:Lee W, MVP
ID: 39998478
Using some trial and error and inspiration from your comment and a sudden rememberance of my own debugging skills, I ended up with the following that worked:

Me![Sub Form Name].Form!SubForm2.Form.ColumnName.ColumnHidden = True

Convoluted and I would have preferred Access recognize things... but it didn't.

Thanks for the inspiration.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39998724
you could probably have used the subforms Load event with something like:

me.ColumnName.ColumnHidden = (me.parent.Name = "FormW1")
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question