Set all controls in a form to read only (Control.Enabled = False) except the controls given in an a
Set all controls in a form to read only (Control.Enabled = False) except the controls given in an array.
Rate Set all controls in a form to read only (Control.Enabled = False) except the controls given in an a
(1(1 Vote))
Dim MyControl As Control
Dim MyArrayField As Variant
''21.3.2000 merror
On Error GoTo Err_SetFormToReadOnly
For Each MyControl In frmName.Controls
''Activebar doesn''t have a .enabled property
If Not TypeOf MyControl Is ActiveBar Then MyControl.Enabled = False
If TypeOf MyControl Is frame Then MyControl.Enabled = True
If TypeOf MyControl Is StatusBar Then MyControl.Enabled = True
If TypeOf MyControl Is Label Then MyControl.Enabled = True
For Each MyArrayField In CtrlsToKeepEnabled
If MyControl.Name = MyArrayField Then
MyControl.Enabled = True
End If
Next
Next
Exit_SetFormToReadOnly:
Exit Sub
Err_SetFormToReadOnly:
''Here the Code for my specific Error-Handling
Resume Exit_SetFormToReadOnly
End Sub
Set all controls in a form to read only (Control.Enabled = False) except the controls given in an a Comments
No comments yet — be the first to post one!
Post a Comment