469,354 Members | 2,046 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,354 developers. It's quick & easy.

Show/hide Subform

I am building a form. The main form will be more of a switch board with summary information related to one project.

Each project has 3 main categories. So the summary would look something like this:
item 1 Item 2 Item3
Cat 1 100 20 5
Cat 2 1000 100 0
Cat 3 0 5 50

Where
Item 1 is the goal
Item 2 is the current
Item 3 is the projected

Each Category then has a set of Sub Categories

What I would like to do is have the user click on the label for Cat 1 (ECT) and have a subform show that has the Sub Items for Cat 1. On the SubForm would be a button to hide the subform


So basically I need a way to set the visible property of a subform to true from the main form. And then set it to false from with in the subform.
Mar 29 '07 #1
10 11456
Rabbit
12,516 Expert Mod 8TB
The absolute path to the property of a control on a form is:
[Forms]![Form Name]![Control Name].propertyname
Mar 29 '07 #2
Thank you for fast reply


So for my test I have

Form 1 = MainForm
Form 2 = BlankForm

Form 2 is embeded in Form 1 as a SubForm

In the OnClick Event of Label 1 I set the code to

[Forms]![MainForm].[BlankForm]![Visible] = True

And in the subform in a command button I set the On Click to

[Forms]![MainForm].[BlankForm]![Visible] = False

Leaving out all brackets

Is that the gest?
Mar 29 '07 #3
Rabbit
12,516 Expert Mod 8TB
That's the gist. But you have to flip the . and the last !
In your case you can leave off the brackets, the brackets are used when you have unconventinonal Form names likes names with a space in it or some non-alphanumeric character.
Mar 29 '07 #4
AccessIdiot
493 256MB
So you can set whole forms/subforms to visible or not? I thought you could only cycle through the controls on a form/subform and set their visible properties to true/false.
Mar 29 '07 #5
I know this is going to be simple.

I keep getting the same error.
"The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX Control."

Here is the code I used.

Private Sub Label18_Click()
Forms!MainJobCostWindow!BlankForm.Visible = True
End Sub
Mar 29 '07 #6
Rabbit
12,516 Expert Mod 8TB
So you can set whole forms/subforms to visible or not? I thought you could only cycle through the controls on a form/subform and set their visible properties to true/false.
I assume you can. For a subform at least, not the main form. I see no reason why you can't.
Mar 29 '07 #7
Rabbit
12,516 Expert Mod 8TB
I know this is going to be simple.

I keep getting the same error.
"The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX Control."

Here is the code I used.

Private Sub Label18_Click()
Forms!MainJobCostWindow!BlankForm.Visible = True
End Sub
Hmm.. should work. I just tested it, albeit with a command button but in this case same difference. Where's the Label18 located?
Mar 29 '07 #8
It is located on the main form.
Mar 29 '07 #9
Rabbit
12,516 Expert Mod 8TB
Check your library references and make sure they're all there.
Mar 29 '07 #10
Just curious, why would you want to hide a subform?

TIA (thanks in advance)
Apr 2 '07 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Ajai Kumar .R | last post: by
10 posts views Thread by oLE | last post: by
3 posts views Thread by alex | last post: by
4 posts views Thread by bridgemanusa | last post: by
7 posts views Thread by FP | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.