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

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
 
S

Stuart McCall

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top