Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    Spokane, WA
    Posts
    81

    Unanswered: Formatting Report Page

    I have the following code in a report to "hide" blank fields.

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim Ctrl As Control
    For Each Ctrl In Me.Controls
    If Ctrl.ControlType = acTextBox Then
    If IsNull(Ctrl.Value) Then Ctrl.Visible = False Else Ctrl.Visible = True
    End If
    Next Ctrl

    End Sub


    It works wonderfully, what I am wondering is can the rest of the report move up to fill in the area left blank?

  2. #2
    Join Date
    Mar 2004
    Posts
    52
    I think this will be awkward to code, but it is possible.

    Declare a variable 'height'. Each time you make a control invisible that has an impact on the y-coordinate of the controls beneath make height=height-x (x being the size that is freed by 'removing' the control).

    After the disabling of the controls, set the propertie 'top' of the controls to height + offset. The offset declares the space between the first control and the second, it should be increased for each following control.

    Hope this gets you started.

    Philip

  3. #3
    Join Date
    Sep 2003
    Location
    Spokane, WA
    Posts
    81

    Yikes

    Awkward is true. It is kind of beyond me as I am a pretty basic user. The code I pasted was provided via a user on this forum.



    Originally posted by ptrapp
    I think this will be awkward to code, but it is possible.

    Declare a variable 'height'. Each time you make a control invisible that has an impact on the y-coordinate of the controls beneath make height=height-x (x being the size that is freed by 'removing' the control).

    After the disabling of the controls, set the propertie 'top' of the controls to height + offset. The offset declares the space between the first control and the second, it should be increased for each following control.

    Hope this gets you started.

    Philip

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    One of the best ways (I think) to format a report is to place the format (record wise) into a Temporary table. Otherwise your in for a lot of conditional code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •