Eliminate spaces between records where record lines vary

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hschleckser

    #1

    Eliminate spaces between records where record lines vary

    I want to print a report. Each record may have blank fields which I eliminate with the can shrink property. However this leaves varying spaces between records. I would like to control the space between these records. Any help will be appreciated.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    I think you'll need something like this in the Detail's onFormat event.
    Code:
    with Me
     !detail.height = ?? ' whatever the highest value can be for your detail 
    if nz(!txtA,"")="" and nz(!txtB,"")="" and nz(!txtC,"")="" then
        txtA.top = 0
        txtB.top = 0
        txtC.top = 0
        txtA.visible = false
        txtB.visible  = false
        txtC.visible = false
    else
        txtA.Top= ?  ' where you want the second line of the detail to begin. It's twips, not inches
        txtB.top = ?
        txtC.top = ?
        txtA.visible = true
        txtB.visible = true
        txtC.visible = true
    endif
        detail.height = txtA.top + txtA.height ' will shorten the detail if these 3 are at the top
    end with
    Also, if it could be that all the printed fields are blank you could do this in the detail format event:
    Code:
       if (all of them are blank) then
         docmd.cancelevent
       endif
    Jim

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      A lot of good stuff there from Jim. You could also consider relying on Access never allowing a value less than that needed to display the contained items. Set it to 0 and it will set it as the lowest value it can. From here, add any value you want, to avoid that chopped look (like border space).

      Comment

      Working...