Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/101677

From BetaArchive Wiki
Knowledge Base


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.

  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: kbprb KB101677