Report with cangraw textbox

M

Mark

Good morning to everybody



I need to draw a transversal line on some my reports to cancel

the non written report part.

I have made this routine to draw the line.



Private Sub Report_Page()
Dim A As double, B As Double, C As Double, D As Double
Me.DrawStyle = 0
Me.DrawWidth = 2
A = numberrowpage
B = Me.IntestazionePagina.Height + Me.Corpo.Height * A +
Me.PièDiPaginaReport.Height
C = Me.ScaleHeight - Me.PièDiPaginaPagina.Height
If B > C - 300 Then Exit Sub
Me.Line (0, B)-(Me.Width, C)
End Sub



Everything works well till I put in report a textbox with the properties

CanGrow and or CanShrink.

In this case the value B of the routine is not correct.

Has someone solved this problem?



Many Thanks in advance



Marco Dell'Oca
 
M

Marshall Barton

Mark said:
I need to draw a transversal line on some my reports to cancel
the non written report part.

I have made this routine to draw the line.

Private Sub Report_Page()
Dim A As double, B As Double, C As Double, D As Double
Me.DrawStyle = 0
Me.DrawWidth = 2
A = numberrowpage
B = Me.IntestazionePagina.Height + Me.Corpo.Height * A +
Me.PièDiPaginaReport.Height
C = Me.ScaleHeight - Me.PièDiPaginaPagina.Height
If B > C - 300 Then Exit Sub
Me.Line (0, B)-(Me.Width, C)
End Sub



Everything works well till I put in report a textbox with the properties
CanGrow and or CanShrink.

In this case the value B of the routine is not correct.


Note that you should be declaring your valiables as Long,
not Double.

Move the declaration of B to the module level:
Private B As Long

Then use this line of code in the detail section's Print
event to remember the bottom of the last detail on the page:
B = Me.Top + Me.Section(0).Height

Then your code in the Page event would be:

Private Sub Report_Page()
Dim C As Long
Me.DrawStyle = 0
Me.DrawWidth = 2
C = Me.ScaleHeight - Me.PièDiPaginaPagina.Height
If B > C - 300 Then Exit Sub
Me.Line (0, B)-(Me.Width, C)
End Sub
 
M

Mark

Marshall Barton said:
Note that you should be declaring your valiables as Long,
not Double.

Move the declaration of B to the module level:
Private B As Long

Then use this line of code in the detail section's Print
event to remember the bottom of the last detail on the page:
B = Me.Top + Me.Section(0).Height

Then your code in the Page event would be:

Private Sub Report_Page()
Dim C As Long
Me.DrawStyle = 0
Me.DrawWidth = 2
C = Me.ScaleHeight - Me.PièDiPaginaPagina.Height
If B > C - 300 Then Exit Sub
Me.Line (0, B)-(Me.Width, C)
End Sub


Many thanks for your reply
I have solved my problem.

Marco Dell'Oca
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top