[AccessD] How To Make All Controls on a Form Invisible

Paul Hartland paul.hartland at googlemail.com
Fri Mar 29 16:29:48 CDT 2013


I usually loop through the controls, just done a quick test created a form
called Form1, then added three buttons named Button1, Button2, Button3 and
put the following code in the open event,

    Dim ctrls As Control
    For Each ctrls In Forms("Form1").Controls
        If ctrls.Name = "Button2" Then
            Me(ctrls.Name).Visible = False
        End If
    Next

Paul





On 29 March 2013 21:25, Jim Dettman <jimdettman at verizon.net> wrote:

>
>   You can do it by section:
>
>    Me.Detail0.Visible = False
>
>  Otherwise, you'll need to loop through the forms control collection.
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
> Sent: Friday, March 29, 2013 04:59 PM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] How To Make All Controls on a Form Invisible
>
> All,
>
> We have an Access 2007 application that has a form which contains many
> controls (buttons).
>
> This application is now going to be placed on a PC where the user is
> only suppose to see only 1 button.
>
> Is there an easy way in VBA to make all buttons on the form invisible.
> (This would be followed by a single line of code to make the single
> button visible for this specific user.)
>
> Thanks,
> Brad
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



-- 
Paul Hartland
paul.hartland at googlemail.com


More information about the AccessD mailing list