Yes/No Fields to show up on report

  • Thread starter Thread starter Denise
  • Start date Start date
D

Denise

I have several fields in a table (50) that are yes/no
check boxes on the form. I want only the fields that are
checked off YES to show up on my report.

Thank you for your help.

Denise
 
Open the report in design view.
Delete the check boxes, and replace them with text boxes (still with Control
Source for each y/n field.).

Set the Format property of the text boxes to these 3 characters:
;\ü
That's:
semicolon
backslash
Hold down the Alt key, and type 0252 on the numeric keypad.
Now set the Font to Wingdings.

The trick works because False is zero, and True is -1. You specified a
format that is blank for positive numbers and zero (nothing before the
semicolon), followed by a literal character (indicated by backslash) of
number 252. In the Wingdings font, this is a check mark. If you want a check
mark surrounded by a box, use 0254 instead.
 
Well, you could have code in the detail format event:
[CheckBoxA].Visible = [CheckBoxA]
..... etc.
[CheckBoxYY].Visible = [CheckBoxYY]

But I think it would be simpler to cheat so no coding is needed.
Include the 50 Check Box fields in the Report RecordSource as usual.
Then, instead of dragging the actual check box fields into the report, add
an unbound text control.
Set it's control source to the [CheckBoxA] field.
Set it's Font Style to 'Wingdings'.
Set it's Format Property to (simply highlight the below 6 characters
and paste them (as a group) into the control's format property):

;\þ;""

Whenever the check box value is Yes (-1) the check box will be shown.
If the value is unchecked (0), nothing will appear.

(That þ character is actually a wingdings chr(254), a check box.)

The nice thing about this method is that you can even make the check box
larger if you like. Just change the FontSize.
For the additional check controls needed, simply copy this one and paste it
back into the section. You now have 2 controls. Separate them a bit.
Select both of these controls, copy them and paste them back into the
section. You now have 4 controls.
Separate these so they are individual.
Select these 4, copy and paste them. You now have 6. Separate, Copy and
Paste. Now you have 12, etc.

When you get your 50 controls set up in the report,
***CHANGE EACH control source to the appropriate CheckBox field, and all is
done. ***

Note: If you would rather have a check mark (without the surrounding square
box) use;
;\ü;""

(a chr(252) instead).

Hope this helps.
 
I did this and it worked except for the label for the
check box. I need it to show up when marked yes, but not
when marked no. How do I stop this from showing on the
report when the check box is not marked off?

Thank you so much for your help.

Denise
 
Right-click the label, and Change To | Text Box.

In the Control Source of the new text box:
=IIf([MyYesNoField], "This text", Null)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.


I did this and it worked except for the label for the
check box. I need it to show up when marked yes, but not
when marked no. How do I stop this from showing on the
report when the check box is not marked off?

Thank you so much for your help.

Denise
 
Back
Top