Prevent edits on specific controls (1 Viewer)

tmyers

Well-known member
Local time
Today, 18:16
Joined
Sep 8, 2020
Messages
1,090
I am trying to prevent changes to specific controls when a record is not new to prevent accidental editing and to have more control over when an edit occurs. Is there a way to check on a form if the record is new and if not, locked and disable a series of controls along with changing their background to be grayed out to represent the fact they cant be used? All the controls on the form I wish to "lock" are text boxes with the exception of one which is a combo if that matters.

Would I use Me.NewRecord to check if the record is new then re-enable the controls then if it returns false, disable them?
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:16
Joined
Sep 21, 2011
Messages
14,310
Most people use the Tag property for anything like this.
Set that property for your controls and then loop through and disable/lock is whatever you use as keyword is found.
And yes, Me.NewRecord would be the property to check.
 

Minty

AWF VIP
Local time
Today, 23:16
Joined
Jul 26, 2013
Messages
10,371
In the current event check for Me.NewRecord.

You can then set the controls Enabled property to No, that will grey it out and disable it in one fell swoop.
You can use the various controls tag property to loop around them in one go.
 

tmyers

Well-known member
Local time
Today, 18:16
Joined
Sep 8, 2020
Messages
1,090
The tag you two reference, is that the "Tag" property in the Other tab at the bottom in 2016?
 

Users who are viewing this thread

Top Bottom