Enablig/Disabling controls

Y

Yair Sageev

Greetings again,

I want to enable/disable controls on a contiuous subform detail section
based on whether a checkbox is clicked.

I wrote the following code for the click event of the checkbox:

Private Sub COCB_Click()
Dim cCtrl As CheckBox
Dim cCtrl2 As Control
Dim cCtrl3 As Control

Set cCtrl = Me.COCB
Set cCtrl2 = Me.COExecStatus
Set cCtrl3 = Me.COVisNum


If cCtrl.Value = False Then
cCtrl2.Enabled = False
cCtrl3.Enabled = False
Else
cCtrl2.Enabled = True
cCtrl3.Enabled = True
End If
End Sub

The problem is, it enables/disables EVERY control on EVERY detail section.

What am I doing wrong?


Thanks.
 
A

Andrew Smith

The problem is that there is only actually one set of controls on a
continuous forms - it is just repeated several times. So if you chage the
properties of a control it will affect every record.

Instead of using the code have a look a conditional formatting instead.
 
Y

Yair Sageev

Andrew Smith said:
The problem is that there is only actually one set of controls on a
continuous forms - it is just repeated several times. So if you chage the
properties of a control it will affect every record.

Instead of using the code have a look a conditional formatting instead.

Confirmed, I found the same answer you gave on a number web sites. Access
does indeed cascade controls from detail to detail.

Microsoft should fix this, IMO, because I'm sure there are many people who
want this behavior..
 

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