Solved

Locking and Unlocking Fields on a Form

Posted on 2014-01-05
2
287 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
2 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 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 49

Expert Comment

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

/gustav
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now