Checking various controls and if a control is locked then do somet

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

Hi,
I am trying to go through an Access form coding where I am checking each
control in the form. If a control is locked then I will have specific code.
However, I cannot get to code this correctly. Any help is appreciated. Thanks
CODE:
For Each ctlC In frm.Controls
If TypeOf ctlC Is TextBox Or TypeOf ctlC Is ComboBox Or TypeOf ctlC
Is CheckBox Then
If Not Locked(ctlC) Then
' do something
End If 'Added the end if statement for the new if statement to
End If
Next ct

PS: I am not sure how to handle the locked controls in code
 
Jack said:
Hi,
I am trying to go through an Access form coding where I am checking each
control in the form. If a control is locked then I will have specific
code.
However, I cannot get to code this correctly. Any help is appreciated.
Thanks
CODE:
For Each ctlC In frm.Controls
If TypeOf ctlC Is TextBox Or TypeOf ctlC Is ComboBox Or TypeOf
ctlC
Is CheckBox Then
If Not Locked(ctlC) Then
' do something
End If 'Added the end if statement for the new if statement to
End If
Next ct

PS: I am not sure how to handle the locked controls in code

Change this line:

If Not Locked(ctlC) Then

to:

If Not ctlC.Locked Then
 
Back
Top