Change line height at print time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill Short

    Change line height at print time

    I have a subreport in the detil section of my main report. The
    subreport can grow. I have a vertical line that fills the rest of the
    section. As you can probably guess I need to change the top and
    height of the line depending on the size of the subreport. During the
    OnPrint event I can capture the height of the subreport in twips and I
    already know the height that I need the detail section to be. What I
    can not do is change the top or height of the line during the OnPrint
    event. I get a "type mismatch" error.

    Can this be done or am I just doing it wrong?

    Thanks,

    Bill
  • Bas Cost Budde

    #2
    Re: Change line height at print time

    The error message makes me hopeful. What assignment do you have in code,
    and what kind of error is it (numbered with 'trace' option?)

    Bill Short wrote:
    [color=blue]
    > What I
    > can not do is change the top or height of the line during the OnPrint
    > event. I get a "type mismatch" error.
    >
    > Can this be done or am I just doing it wrong?
    >
    > Thanks,
    >
    > Bill[/color]

    --
    Bas Cost Budde

    Comment

    • Stephen Lebans

      #3
      Re: Change line height at print time

      You cannot modify the dimensions of a control during the Print event,
      period.
      Instead frae the line using the Line method of the Report object. For
      sample code see the older non class based functions at the bottom of the
      page here:


      --

      HTH
      Stephen Lebans

      Access Code, Tips and Tricks
      Please respond only to the newsgroups so everyone can benefit.


      "Bill Short" <wjs@haroldbeck .com> wrote in message
      news:fb35702c.0 401290518.2e74a b73@posting.goo gle.com...[color=blue]
      > I have a subreport in the detil section of my main report. The
      > subreport can grow. I have a vertical line that fills the rest of the
      > section. As you can probably guess I need to change the top and
      > height of the line depending on the size of the subreport. During the
      > OnPrint event I can capture the height of the subreport in twips and I
      > already know the height that I need the detail section to be. What I
      > can not do is change the top or height of the line during the OnPrint
      > event. I get a "type mismatch" error.
      >
      > Can this be done or am I just doing it wrong?
      >
      > Thanks,
      >
      > Bill[/color]

      Comment

      • Bill Short

        #4
        Re: Change line height at print time

        Private Sub Detail_Print(Ca ncel As Integer, PrintCount As Integer)

        On error goto ErrorHandler
        Dim intSubHeight As Integer
        Const DetailSectionHe ight As Integer = 8723

        intSubHeight = Reports!rptRota ry!rptVMSParts. Height

        Me.DetailLineRi ght.Height = DetailSectionHe ight - intSubHeight
        Me.DetailLineLe ft.Height = DetailSectionHe ight - intSubHeight
        Me.DetailLineRi ght.Top = intSubHeight + 1
        Me.DetailLineLe ft.Top = intSubHeight + 1

        Exit_ErrorHandl er:
        Exit Sub

        ErrorHandler:
        MsgBox Err.Number + Err.Description
        Resume Exit_ErrorHandl er


        End Sub

        Run time error '13'
        Type Mismatch

        Thanks,

        Bill
        Newtown, PA

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Bas Cost Budde

          #5
          Re: Change line height at print time

          Stephen Lebans' answer is correct (of course). Did you play with Me.Line
          (in the Print handler for you report) yet?

          --
          Bas Cost Budde

          Comment

          • Bill Short

            #6
            Re: Change line height at print time

            Thanks for pointing me to the line method. I have it working with the
            following code with one problem. When I open the detail section up to
            the size I need for the lines to touch the lines that begin at 0.0" of
            the footer section the report adds a 2nd page with only the header and
            footer on it. Have you ever seen this before?

            Dim ctlDetail As Control

            For Each ctlDetail In Me.Section(acDe tail).Controls
            With ctlDetail
            Me.Line (.Width, (.Height + 1))-(.Width, Me.Height)
            Me.Line (.Left, (.Height + 1))-(.Left, Me.Height)
            End With
            Next

            Set ctlDetail = Nothing


            Thanks,

            Bill
            Newtown, PA

            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            Working...