Hide a bunch of contols

R

Richard Stricker

Hi, Got another question. I have several controls on a form that i want to
hide based on a checkbox.

Do i have to specify each control and its label, one at a time, visible or
not visible?

Is there some sort of "canvas" or "enclosure" those fields can be associated
with to make them visible as a group.

I tried grouping them but then didn't have a name for the group to hide it.

Do i have to use a subform to do this?

Thanks for your help with this.

Richard
 
S

Steve

You don't use a subform to do this.

Open your form in dsign view and select all the controls you want to hide.
Open properties, go to the Other tab and enter something such as HideThese
in the Tag property. Now you can write code to cycle through all the
controls on your form and for those with "HideThese" in the Tag property,
you cab make them visible or not visible as desired.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
S

StopThisAdvertising

Steve said:
You don't use a subform to do this.

Open your form in dsign view and select all the controls you want to hide.
Open properties, go to the Other tab and enter something such as HideThese
in the Tag property. Now you can write code to cycle through all the
controls on your form and for those with "HideThese" in the Tag property,
you cab make them visible or not visible as desired.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)

--
You are *not* a resource at all !!
Tell us you will stop advertising here, or get lost for another year or so...
http://home.tiscali.nl/arracom/whoissteve.html

ArnoR
 
R

Richard Stricker

Hi Steve, thanks for the suggestion. I will give it a try.

How does the code to cycle through the controls go?
Something like:
For each control on the form (how do you say that?) if the tag is equal to
"Hide These" then

Control.visible (how do you say that?) = false
Next

End if

Thanks for your help on this feature. Honestly, I didn't notice any
advertisement involved.

Richard
 
M

missinglinq via AccessMonster.com

As Steve said
"Open your form in dsign view and select all the controls you want to hide.
Open properties, go to the Other tab and enter something such as HideThese
in the Tag property. Now you can write code to cycle through all the
controls on your form and for those with "HideThese" in the Tag property"

When you enter the "HideThese" in the Tag property, omit the quotation marks.

Now, in the following code, the Checkbox is called HideControls. You can use
this name, or replace it with a name of your choice. Place this code in the
code module for your form.

Private Sub Form_Current()
Dim ctrl As Control
If HideControls Then
For Each ctrl In Me.Controls
If ctrl.Tag = "HideThese" Then
ctrl.Visible = False
End If
Next
Else
For Each ctrl In Me.Controls
If ctrl.Tag = "HideThese" Then
ctrl.Visible = True
End If
Next
End If
End Sub

Private Sub HideControls_Click()
Dim ctrl As Control
If HideControls Then
For Each ctrl In Me.Controls
If ctrl.Tag = "HideThese" Then
ctrl.Visible = False
End If
Next
Else
For Each ctrl In Me.Controls
If ctrl.Tag = "HideThese" Then
ctrl.Visible = True
End If
Next
End If
End Sub

Good Luck!
 
R

Richard Stricker

Hi, thanks for the exact help. I was able to both understand and use the
code you provided.

Your time and knowledge are appreciated!

Richard
 
S

StopThisAdvertising

Richard Stricker said:
Thanks for your help on this feature. Honestly, I didn't notice any
advertisement involved.

Richard

You are right Richard. I know that there is no advertising involved here.

Also Steve knows very well that we warned him about this several times ....
We warned him about hunting each and every post he would make. He ignores that.
It is sad it has to be this way. Steve just want's to be slammed in the face.

He has a very *bad* record in the groups here concerning his advertising.
We just want him to stop doing that.

The 'good' posts and the 'bad' posts are a pattern.
He believes he 'deserves' the right to advertise when he posts 'good' answers.
Look at the link I provided and you will understand.

He only needs to stop advertising and is very much allowed his 'good' posts.
Also his sigline is not the problem... he knows that very well.
He is just a stubborn a$$.
It is bad luck for him hat we are stubborn too...

ArnoR
 
G

Guest

would this work with multiple groups for each control?

for example if i have 3 controls a, b, and c, that under certain
circumstances i needed all three to not be visible, then under different
circumstances i needed a and b to be visible and c not, and then a different
circumstance i needed b and c but not a... etc.

could i put in a tag "open, closed, submitted, processed" and then use code
to find then in a case select and hide and unhide accordingly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top