bill201
asked on
problem with a formula to close all controls in a form in microsoft access 2010
my code is
but i get a compile error because vba don't recognize the "controltype"
but i get a compile error because vba don't recognize the "controltype"
If Me.Closed = True Then
Dim Ctrl As Controls
For Each Ctrl In Me.Controls
If Ctrl.ControlType = acTextBox Or Ctrl.ControlType = acCheckBox Or Ctrl.ControlType = acComboBox Or Ctrl.ControlType = acSubform Then
Ctrl.Locked = True
End If
Next Ctrl
Else
Dim Ctrl As Controls
For Each Ctrl In Me.Controls
If Ctrl = acTextBox Or Ctrl.ControlType = acCheckBox Or Ctrl.ControlType = acComboBox Or Ctrl.ControlType = acSubform Then
Ctrl.Locked = True
End If
Next Ctrl
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If Ctrl.ControlType = acTextBox Or Ctrl.ControlType = acCheckBox Or Ctrl.ControlType = acComboBox Or Ctrl.ControlType = acSubform Then
Ctrl.Locked = (Me.Closed = True) ' or (Not Me.Closed = True)
End If
Next Ctrl