Solved

Show/Hide Columns in Subform

Posted on 2014-04-14
3
538 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
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now