Go Back   Access World Forums > Microsoft Access Reference > Sample Databases

Thread Tools Rating: Thread Rating: 4 votes, 4.50 average. Display Modes
Old 04-27-2017, 04:48 AM   #1
Gold Supporter
ridders's Avatar
Join Date: Jan 2017
Location: Somerset, UK
Posts: 2,889
Thanks: 52
Thanked 680 Times in 628 Posts
ridders has a spectacular aura about ridders has a spectacular aura about
Set a group of controls as visible/hidden, enabled/disabled or locked/unlocked

The attached utility demonstrates a way of setting the state of a group of controls at the same time using the controls' Tag property.

The properties that can be controlled are: .Visible , .Enabled, .Locked

However, some control types do not allow all of the properties.
For example labels can not be disabled or locked

For full details of control types & properties, see the table tblControlTypes

All the controls in the 2 forms have tags A, B, C or D.
Use the buttons to control the state of those with tags A, B, C
To ensure the form remains usable, controls with tag D remain visible, enabled & unlocked at all times!

The forms aren't intended to be elegant, just to show what can be done

UPDATED 29/04/2017:
For portability, all the functionality is now included in the module modControlState.
There are 3 procedures: ShowControls, EnableControls & LockControls

2 forms have been included - identical apart from colour
This is just to confirm that the forms are controlled independently as you would expect

To use this approach, just copy the module modControlState to your own project

An alternative approach suggested by Static & using parameter arrays rather than tags is listed in Module1 but has not been used here
Attached Images
File Type: png SetControls.PNG (71.7 KB, 611 views)
Attached Files
File Type: accdb SetControls - v2.accdb (864.0 KB, 308 views)

Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Tapatalk

If this answer has helped, please click the Thanks button and/or click the 'reputation' scales symbol on the left and leave a comment. Cheers!

Last edited by ridders; 05-21-2017 at 09:37 AM. Reason: Added inline image
ridders is offline   Reply With Quote
The Following 3 Users Say Thank You to ridders For This Useful Post:
gleesonc (07-05-2017), MrHans (04-27-2017), usm01 (07-25-2017)

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Setting a group of controls visible/hidden or enabled/disabled ridders Modules & VBA 9 04-27-2017 05:59 AM
Click Locked/Disabled controls, prompt for variable Futures_Bright Modules & VBA 0 08-06-2013 02:44 AM
Make Controls visible with Option group IanT76 Forms 4 07-09-2012 10:20 PM
Locked/unlocked aldeb Forms 1 06-13-2005 08:15 AM
locked and unlocked records Webster01 Forms 1 03-26-2002 08:25 AM

All times are GMT -8. The time now is 01:09 PM.

Microsoft Access Help
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit

Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World