Conditionally suppress on a form

buggered

Buggered
Local time
Today, 09:15
Joined
Oct 10, 2005
Messages
7
Hi all

Long time searcher, first time poster!

I have a subform which has loads of check boxes for each record but i want to suppress certain boxes depending on criteria in each record. I think i need to do a For..Each statement but, as my user name suggests, I'm buggered!.
 
Well first, having "loads of check boxes" is usually an indication of a denormalized structure. You might want to rethink the structure.

However, you can cycle thru the controls using code like:
Code:
Dim ctl As Control, frm As Form
    Set frm = "formname"
    On Error Resume Next
    For Each ctl In frm.Controls
        With ctl
            If .ControlType = acCheckbox Then
                If some condition then
                     .Visible = False
                Else
                     .Visible = True
                End If
            End If
        End With
    Next ctl
    Set ctl = Nothing:    Set frm = Nothing

You can modify that as needed using a condition to determine whether the control should be visible or not.
 
Thanks Scott - appreciate your assistance
 

Users who are viewing this thread

Back
Top Bottom