By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,434 Members | 2,902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,434 IT Pros & Developers. It's quick & easy.

Change line height at print time

P: 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
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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:
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

Nov 12 '05 #2

P: n/a
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" <wj*@haroldbeck.com> wrote in message
news:fb**************************@posting.google.c om...
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


Nov 12 '05 #3

P: n/a
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!
Nov 12 '05 #4

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

--
Bas Cost Budde

Nov 12 '05 #5

P: n/a
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!
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.