?
Solved

Locking and Unlocking Fields on a Form

Posted on 2014-01-05
2
Medium Priority
?
299 Views
Last Modified: 2014-01-05
Hi,

I have a form the most of the time needs to be read only.

Up 'til now I have locked all the text boxes.

The users have been able to unlock a particular field by clicking a button that toggles the Locked property for that text box.

I now want to unlock all the fields by the click of one toggle button.  What's the best way to do this?

a) Using the Allow Edits property instead
b) Looping through the text boxes (but I don't know how)
c) Setting each control to unlocked one at a time.
d) another way

Cheers
0
Comment
Question by:LJKMartin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 39757460
This depends on whether you also want to keep the individual unlock functionality.  If you don't need that feature anymore then setting the AllowEdits property to True would be the simplest way.  You would first need to set the Locked properties of all textboxes back to False and then your button to unlock them should have AllowEdits = False.

However, if you would like to have the individual unlock along with a group unlock, you would need your button to call a procedure that loops through your buttons and sets their Locked properties to False.  You could use something like this:
    Dim ctl As Control
    
    For Each ctl In Me
        If ctl.ControlType = acTextBox Then ctl.Locked = False
    Next

Open in new window

0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 39757466
I would use a) ... perhaps combined with AllowAdditions = False

/gustav
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question