Link to home
Start Free TrialLog in
Avatar of J G
J G

asked on

Explanation of Access VBA code

this is regarding question 41925874.
Could you add 2 or 3 comments to the code below just giving me a rough outline/explanation of what it is doing.  I want to understand it better. in particular the

 Next ctl
 Set ctl = Nothing

 1:Public Sub LockControls(frm As Form, bLock As Boolean)
 2:    Dim ctl As Control
 3:    For Each ctl In frm.Controls
 4:    Select Case ctl.ControlType
 5:        Case acTextBox, acComboBox, acListBox, acCheckBox
 6:            Select Case ctl.Tag
 7:                Case "NoLock"
 8:                    ctl.Locked = False
 9:                Case "Lock"
 10:                    ctl.Locked = True
 11:                Case Else
 12:                    ctl.Locked = bLock         'toggle locks
 13:            End Select
 14:        Case acCommandButton
 15:            Select Case ctl.Tag
 16:                Case "NoLock"
 17:                    ctl.Enabled = True
 18:                Case "Lock"
 19:                    ctl.Enabled = False
 20:                Case Else
 21:                    ctl.Enabled = Not bLock         'toggle locks
 22:            End Select
 23:    End Select
 24:Next ctl
 25:Set ctl = Nothing
 26:End Sub
SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial