ACC: No CanShrink Property for Check Boxes

Last reviewed: May 28, 1997
Article ID: Q101677
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

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

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.

  1. 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.

  2. Size and position the text box and its label so that it looks like a check box.

  3. Change the Name property of the text box label control to lblCheck1.

  4. Set the following properties for the report's detail section:

          CanShrink: Yes
          OnFormat: ShrinkNo
    

  5. Create the following macro and save it as ShrinkNo:

          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
    
    

  6. 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.

REFERENCES

For more information about the CanShrink Property, search the Help Index for "CanShrink property."


Additional query words: shrink can
Keywords : FmsHowto kbusage
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.