• Micromanaging a report format

    Author
    Topic
    #482142

    I have a need to try to compress a report as much as possible. Two main report controls are one displaying a table memo field and a second displaying a table OLE OBject (embedded picture). About half the input table entries contain a picture. The picture, when present is displayed as 2.5″wx2″h and the memo text and picture are displayed side by side. My objective when there is no picture is to reduce the height of the picture control and extend the width of the text memo control. Thus reducing the overall length of the report.

    I’ve added the following code to the Detail_Format sub:
    If _
    Len(nz(Me!UM_Pic,””))= 0 _
    Then
    Me!UM_Textx.Width = 6 * 1440
    Me!UM_Pic.Height = 0
    Else
    Me!UM_Textx.Width = 4 * 1440
    Me!UM_Pic.Height = 2 * 1440
    End If

    Detail.Height = 1
    End Sub

    What’s happening when there is a picture is the height of the Detail section is over an 1″ greater than the tallest control (for testing both controls have a top of zero). When there is no picture the text prints as desired. For testing I included a border on the memo and picture. The picture is the correct 2″ tall and the text is shorter than the picture, but there is 1 5/8″ gap between the bottom of the picture and the top of the next paragraph.

    Appreciate any thought on how to eliminate the gap.
    Marty

    Viewing 6 reply threads
    Author
    Replies
    • #1324629

      Try setting the width of the picture in code rather than its height. (or perhaps both)
      With a landscape picture, I suspect that the picture is not being displayed 2″ tall as it is not wide enough for that height. So the image control has blank space within in. What Size Mode property do you have for the image. With stretch it will fill up the space alloacted. With Zoom it won’t.

      • #1324707

        John,

        I’ve tested setting just the width and setting both width and height, no change. I have the Size Mode set to Zoom. I tried reducing the height to 1″, still get the gap but it’s only 1″. With a visible border on the control, the control always displays the size set by the code. Depending on the original shape of the picture I get space within the control either on the left or at the bottom.

        Marty

    • #1324724

      With Size Mode set to Zoom the picture retains its original aspect ratio. So if the aspect ratio of the Image Control does not match the aspect ratio of the image file you will get empty space either at the bottom or at the left.
      If you use a Size Mode of Stretch it will ignore the aspect ratio and fill the image control completely, but distort the image.

      If your images are all the same shape you need to work out the right aspect ratio to use for the image control.
      If the images have different aspect ratios it is hard to know what to do. You could use code to determine the width and heght of the image then set the aspect ratio based on those numbers, or use Stretch Mode, or accept the gaps.

    • #1324766

      John,

      I guess I’m either not understanding your point or I’ve not made my problem clear. I’m happy with the presentation of the image in the control even if there is blank space to the right or bottom of the image within the control. The control itself is the size I’d like it to be. My problem is there is significant extra space, outside the control, at the bottom of the detail line when the control has an image. I don’t understand where this comes from. With a border visible on the image control the space measures 1 5/8″ from the bottom of the image control of the detail line with an image to the top of the empty image control on the next detail line.

      Thanks for help and patience.
      Marty

      • #1324775

        See what happens if you add

        Code:
        If FormatCount = 1 Then
        existing code
        
        end if

        Around your code.

        • #1325071

          Got a chance to try it, unfortunately no change, still get the gap.

          Marty

    • #1324773

      I don’t know where it comes from. I have mocked up a report with images, and in my report the extra space is inside the image, when the image is landscape.
      If I put a border around the image then the Detail section of the report finishes at the bottom of the border.

      But I have now put a lot more text into the memo field and I can see the problem.

      I am not sure, but I think Access just gets confused about how much space to allocate to the memo. As it grows to accommodate the text it grows too far.
      I will keep looking.

    • #1325194

      Sorry I don’t have any other suggestions.
      In my mocked up report that extra code fixed the problem.

    • #1325226

      Actually I do have another suggestion.
      Instead of changing the Height of the picture in code:
      Me!UM_Pic.Height = 0
      Me!UM_Pic.Height = 2 * 1440

      Just change its visibility
      Me!UM_Pic.visible = False
      Me!UM_Pic.Visible = True

      and just leave the Height permanently at whatever you want it to be.

      I don’t know why this should work, but I did make this change in my code.
      Initially it did not help, but the report then worked properly when I added the FormatCount code.

    • #1325387

      John,

      Thanks for the additional thoughts. The up side is it worked as you suggested. The downside is without reducing the height on the picture control when there is no picture every detail line is at least the height of the picture control even when the text requires less than the 2 inch setting. As an alternative workaround I’ve stacked the picture and text controls rather than having them side-by-side. Takes up more space than if side-by-side worked, but less than having every detail line having a minimum height of the picture control.

      Thanks again for you assistance,
      Marty

      • #1325406

        The downside is without reducing the height on the picture control when there is no picture every detail line is at least the height of the picture control even when the text requires less than the 2 inch setting.

        Hmm. That is not happening for me. Is the Can Shrink property of both the Detail Section and the Memo field set to yes?
        30396-IllustratedCatalogue

    Viewing 6 reply threads
    Reply To: Micromanaging a report format

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: