Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / August 2007

Tip: Looking for answers? Try searching our database.

Hide a bunch of contols

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Stricker - 23 Jun 2007 19:56 GMT
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
Steve - 23 Jun 2007 20:32 GMT
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
resource@pcdatasheet.com

> Hi, Got another question. I have several controls on a form that i want to
> hide based on a checkbox.
[quoted text clipped - 13 lines]
>
> Richard
StopThisAdvertising - 23 Jun 2007 20:59 GMT
> You don't use a subform to do this.
>
[quoted text clipped - 8 lines]
> Applications
> resource@pcdatasheet.com

Signature

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

Richard Stricker - 24 Jun 2007 01:39 GMT
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
> You don't use a subform to do this.
>
[quoted text clipped - 26 lines]
>>
>> Richard
missinglinq - 24 Jun 2007 02:28 GMT
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!

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Richard Stricker - 24 Jun 2007 07:13 GMT
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

> As Steve said
> "Open your form in dsign view and select all the controls you want to
[quoted text clipped - 47 lines]
>
> Good Luck!
DawnTreader - 30 Aug 2007 20:18 GMT
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?

> As Steve said
> "Open your form in dsign view and select all the controls you want to hide.
[quoted text clipped - 43 lines]
>
> Good Luck!
StopThisAdvertising - 24 Jun 2007 09:22 GMT
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.