Checkbox visible on Report only when checked

P

PMBO

I have a report that uses several checkboxes. (e.g. Committee field with a
checkbox to indicate if they are the Chair, or AH Rep or IM Rep, etc.) I
would like the checkboxes to show on the report only when they are checked.
I've tried to find the code to make this happen, but I can't find an instance
like mine. Is there a code to make the checkboxes (called Chair, AH Rep, WM
Rep, etc.) visible only if they are checked.

Will it be attached to each control individually or to the Detail section of
the Report?
 
W

Wayne-I-M

You can use this

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.CheckBoxName = -1 Then
Me.CheckBoxName.Visible = True
Else
Me.CheckBoxName.Visible = False
End If
End Sub

Change CheckBoxName to what it really is
 
P

PMBO

I put the code in the On Format Event of the Detail Section on the report and
changed the checkbox name, but it's still showing all the checkboxes (checked
and unchecked) for the checkbox IMRep. I also tried using "True" instead of
-1 and that didn't work for me. Am I doing something wrong. thanks Wayne

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.IMRep = -1 Then
Me.IMRep.Visible = True
Else
Me.IMRep.Visible = False
End If
End Sub
 
W

Wayne-I-M

Hi

Dont know what to advise as the code you posted works fine for me.

Have you made sure that the field is formated as Yes/No in the table, etc
 
P

PMBO

So Wayne -

This is the scenario - I have five fields in the table and each person can
be one or more of these five things (each one is datatype Yes/No in the
table). Then the Report (based on that table) is sorted by Person with
checkboxes marked for the role that they play.

So it's like this:

Person's Name
Chair IMRep Rep2 Rep3
Committee X X
Another X X

But when I put the code in the On Format Event of the Detail Section All the
boxes show up checked and unchecked. Is there something wrong in the table?
Am I putting the code in the correct place?

I appreciate your time on this.
 

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

Similar Threads


Top