Microsoft KB Archive/101677

= ACC: No CanShrink Property for Check Boxes =

Article ID: 101677

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q101677



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
There is no CanShrink property for check boxes or option buttons on a form or report.



RESOLUTION
The following workaround demonstrates a method that uses a text box to simulate a check box on a report. Then, you can set the CanShrink property of the text box to Yes, and if the text box is not checked, it will shrink and will not be printed.

  For a report based on a table with a Yes/No data type field called Check1, create a text box on the report with the following properties:

     Name: txtCheck1 ControlSource: =IIf([Check1]=-1," X ") CanShrink: Yes BorderStyle (or BackStyle in Microsoft Access 7.0 and 97): Normal

NOTE: The Name property must not be the same as any of the fields in the ControlSource property formula; otherwise a "#ERROR" message appears when you run the report.  Size and position the text box and its label so that it looks like a check box. Change the Name property of the text box label control to lblCheck1.  Set the following properties for the report's detail section:

     CanShrink: Yes OnFormat: ShrinkNo   Create the following macro and save it as ShrinkNo:

<pre class="fixed_text">     Macro Name   Condition         Action ShrinkNo    [Check1]=-1       SetValue [Check1]=0       SetValue

ShrinkNo Actions SetValue Item: [lblCheck1].Visible Expression: True SetValue Item: [lblCheck1].Visible Expression: False </li> Preview the report. The text box will shrink up if it is the only item sharing the same horizontal plane on the report. Do not overlap the text box with any other control positioned to the left or right of it. The ShrinkNo macro also hides the label for the text box.</li></ol>

<div class="references_section">