- Local time
- Today, 16:29
- Joined
- Jul 9, 2003
- Messages
- 17,287
Lock ALL the Controls on a Form - Nifty Access
In this video I demonstrate how a True/False "If Statement" can be simplified with the word "NOT"... The "NOT Operator" can reverse the logic in your function. If you precede a value which Returns "TRUE" with the "NOT OPERATOR" then it will return "FALSE". You might wonder why on earth you would want to use the "NOT OPERATOR" --- The YouTube video along with the code below, provides an example, which you might find useful...
Code:
Private Function fLockAll(blnChkStatus As Boolean) As String
Dim Ctrl As Control
For Each Ctrl In Me.Controls
Select Case Ctrl.ControlType
Case acComboBox, acListBox, acOptionButton, acTextBox, acSubform ', acToggleButton, acSubform , acLabel , acTabCtl, acOptionGroup, acRectangle ', acCheckBox
Ctrl.Enabled = Not blnChkStatus
Ctrl.Locked = blnChkStatus
Case acCommandButton
Ctrl.Enabled = Not blnChkStatus
End Select
Next Ctrl
btnDuplicateRec.Enabled = True
btnBuildMsgBox.Enabled = True
btnBuildMod.Enabled = True
End Function 'fLockAll