MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.
Public Sub ProtectFields(ColumnNum As String) Dim Ctl As Control For Each Ctl In Forms!Sales_Contract_Review.Controls ' make sure i am looking at the correct textboxes If Ctl.Parent.Name = "Sales_Contract_Review" And IsNumeric(Mid(Ctl.Name, 1, 2)) And Mid(Ctl.Name, 3, 1) = "-" And IsNumeric(Mid(Ctl.Name, 4, 2)) Then ' protect all fields except ones with the passed variable in column 4-5 If Mid(Ctl.Name, 4, 2) <> ColumnNum Then ' msgbox "lock:" & Ctl.Name Ctl.Enabled = False Ctl.Locked = True Else ' msgbox "unlock: " & Ctl.Name If Ctl.Value <> "M" Then Ctl.Enabled = True Ctl.Locked = False End If End If End If Next End Sub