ACC: No CanShrink Property for Check Boxes

ID: Q101677


The information in this article applies to:


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 
Version           : 1.0 1.1 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: March 25, 1999