Connecting Tech Pros Worldwide Help | Site Map

Change line height at print time

  #1  
Old November 12th, 2005, 07:40 PM
Bill Short
Guest
 
Posts: n/a
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
  #2  
Old November 12th, 2005, 07:40 PM
Bas Cost Budde
Guest
 
Posts: n/a

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

  #3  
Old November 12th, 2005, 07:40 PM
Stephen Lebans
Guest
 
Posts: n/a

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:
http://www.lebans.com/PrintLines.htm

--

HTH
Stephen Lebans
http://www.lebans.com
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.0401290518.2e74ab73@posting.google.c om...[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]

  #4  
Old November 12th, 2005, 07:41 PM
Bill Short
Guest
 
Posts: n/a

re: Change line height at print time


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

On error goto ErrorHandler
Dim intSubHeight As Integer
Const DetailSectionHeight As Integer = 8723

intSubHeight = Reports!rptRotary!rptVMSParts.Height

Me.DetailLineRight.Height = DetailSectionHeight - intSubHeight
Me.DetailLineLeft.Height = DetailSectionHeight - intSubHeight
Me.DetailLineRight.Top = intSubHeight + 1
Me.DetailLineLeft.Top = intSubHeight + 1

Exit_ErrorHandler:
Exit Sub

ErrorHandler:
MsgBox Err.Number + Err.Description
Resume Exit_ErrorHandler


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!
  #5  
Old November 12th, 2005, 07:42 PM
Bas Cost Budde
Guest
 
Posts: n/a

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

  #6  
Old November 12th, 2005, 07:49 PM
Bill Short
Guest
 
Posts: n/a

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(acDetail).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!
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
correct equivalent construct for 1 line of code pamela fluente answers 27 April 18th, 2007 01:35 AM
Batch/Block-Mode updates to Select Lists - How to avoid? Richard Maher answers 16 March 25th, 2007 04:55 AM
Best way of finding terminal width/height? Joel Hedlund answers 20 February 15th, 2006 06:05 PM
Mac and CSS Line Spacing Issues PinkBishop answers 9 July 20th, 2005 10:57 PM