PC Review


Reply
Thread Tools Rate Thread

How to draw a vertical line in subreport

 
 
Coderz
Guest
Posts: n/a
 
      19th Apr 2009
The code below perfectly work if it is not located inside a subreport.

Public Sub Report_Page()
Dim X1, Y1, X2, Y2 As Single
Me.DrawStyle = 0 ' a solid line

Me.DrawWidth = 1 ' set the thickness of the line

' Set the coordinates and draw a line down the middle of the page.

X1 = 60 'Int(Me.ScaleWidth / 2) ' find the middle of the page
Y1 = Me.Section(1).Height ' start just below the page header
X2 = X1 ' the line is vertical

' length of line is the length of the Page - (Height of the
PageHeader + Height of the Page Footer).

Y2 = Me.ScaleHeight

Me.Line (X1, Y1)-(X2, Y2) ' This draws the line
Me.Line (955, Y1)-(955, Y2) ' This draws the line
Me.Line (1740, Y1)-(1740, Y2) ' This draws the line
Me.Line (3360, Y1)-(3360, Y2) ' This draws the line
Me.Line (4560, Y1)-(4560, Y2) ' This draws the line
Me.Line (5940, Y1)-(5940, Y2) ' This draws the line
Me.Line (7850, Y1)-(7850, Y2) ' This draws the line
Me.Line (9050, Y1)-(9050, Y2) ' This draws the line
Me.Line (10020, Y1)-(10020, Y2) ' This draws the line
Me.Line (11460, Y1)-(11460, Y2) ' This draws the line
End Sub

This is code is not executed if under a subreport.

How could I execute it? I tried to call it like Call
Me.[Service_Record_Details].Report.Report_Page but it gives an error.
 
Reply With Quote
 
 
 
 
Damon Heron
Guest
Posts: n/a
 
      19th Apr 2009
Report_Page is actually a property of the report. In properties for the
report, look at Event, On Page.
Paste your code there (deleting the Public statement and end sub, and when
report opens, you will have your lines.

Damon

"Coderz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The code below perfectly work if it is not located inside a subreport.
>
> Public Sub Report_Page()
> Dim X1, Y1, X2, Y2 As Single
> Me.DrawStyle = 0 ' a solid line
>
> Me.DrawWidth = 1 ' set the thickness of the line
>
> ' Set the coordinates and draw a line down the middle of the page.
>
> X1 = 60 'Int(Me.ScaleWidth / 2) ' find the middle of the page
> Y1 = Me.Section(1).Height ' start just below the page header
> X2 = X1 ' the line is vertical
>
> ' length of line is the length of the Page - (Height of the
> PageHeader + Height of the Page Footer).
>
> Y2 = Me.ScaleHeight
>
> Me.Line (X1, Y1)-(X2, Y2) ' This draws the line
> Me.Line (955, Y1)-(955, Y2) ' This draws the line
> Me.Line (1740, Y1)-(1740, Y2) ' This draws the line
> Me.Line (3360, Y1)-(3360, Y2) ' This draws the line
> Me.Line (4560, Y1)-(4560, Y2) ' This draws the line
> Me.Line (5940, Y1)-(5940, Y2) ' This draws the line
> Me.Line (7850, Y1)-(7850, Y2) ' This draws the line
> Me.Line (9050, Y1)-(9050, Y2) ' This draws the line
> Me.Line (10020, Y1)-(10020, Y2) ' This draws the line
> Me.Line (11460, Y1)-(11460, Y2) ' This draws the line
> End Sub
>
> This is code is not executed if under a subreport.
>
> How could I execute it? I tried to call it like Call
> Me.[Service_Record_Details].Report.Report_Page but it gives an error.



 
Reply With Quote
 
Damon Heron
Guest
Posts: n/a
 
      19th Apr 2009
I just realized what you are saying - you want the lines on the subreport.
Sorry. But, if
you put the code on the main reports Report_Page property, the lines will be
drawn thru
your subreport. This may require some repositioning of controls to align
the sections,
but it will work.

Damon

"Damon Heron" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Report_Page is actually a property of the report. In properties for the
> report, look at Event, On Page.
> Paste your code there (deleting the Public statement and end sub, and when
> report opens, you will have your lines.
>
> Damon
>
> "Coderz" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> The code below perfectly work if it is not located inside a subreport.
>>
>> Public Sub Report_Page()
>> Dim X1, Y1, X2, Y2 As Single
>> Me.DrawStyle = 0 ' a solid line
>>
>> Me.DrawWidth = 1 ' set the thickness of the line
>>
>> ' Set the coordinates and draw a line down the middle of the page.
>>
>> X1 = 60 'Int(Me.ScaleWidth / 2) ' find the middle of the page
>> Y1 = Me.Section(1).Height ' start just below the page header
>> X2 = X1 ' the line is vertical
>>
>> ' length of line is the length of the Page - (Height of the
>> PageHeader + Height of the Page Footer).
>>
>> Y2 = Me.ScaleHeight
>>
>> Me.Line (X1, Y1)-(X2, Y2) ' This draws the line
>> Me.Line (955, Y1)-(955, Y2) ' This draws the line
>> Me.Line (1740, Y1)-(1740, Y2) ' This draws the line
>> Me.Line (3360, Y1)-(3360, Y2) ' This draws the line
>> Me.Line (4560, Y1)-(4560, Y2) ' This draws the line
>> Me.Line (5940, Y1)-(5940, Y2) ' This draws the line
>> Me.Line (7850, Y1)-(7850, Y2) ' This draws the line
>> Me.Line (9050, Y1)-(9050, Y2) ' This draws the line
>> Me.Line (10020, Y1)-(10020, Y2) ' This draws the line
>> Me.Line (11460, Y1)-(11460, Y2) ' This draws the line
>> End Sub
>>
>> This is code is not executed if under a subreport.
>>
>> How could I execute it? I tried to call it like Call
>> Me.[Service_Record_Details].Report.Report_Page but it gives an error.

>
>



 
Reply With Quote
 
Bruce Kovacs
Guest
Posts: n/a
 
      22nd Apr 2009
I have used the following code in a subreport, and it works fine. The
numbers for the horizontal values were entered manually (trial and error) to
cause the lines to align with the edges of the controls on the subreport.

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
Dim MyDetailHeight As Single
MyDetailHeight = Me.Section(acDetail).Height

Me.ScaleMode = 7
Me.Line (5.101, 0)-(5.101, MyDetailHeight)
Me.Line (5.94, 0)-(5.94, MyDetailHeight)
Me.Line (6.801, 0)-(6.801, MyDetailHeight)
Me.Line (8.1, 0)-(8.1, MyDetailHeight)

End Sub


"Damon Heron" wrote:

> I just realized what you are saying - you want the lines on the subreport.
> Sorry. But, if
> you put the code on the main reports Report_Page property, the lines will be
> drawn thru
> your subreport. This may require some repositioning of controls to align
> the sections,
> but it will work.
>
> Damon
>
> "Damon Heron" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Report_Page is actually a property of the report. In properties for the
> > report, look at Event, On Page.
> > Paste your code there (deleting the Public statement and end sub, and when
> > report opens, you will have your lines.
> >
> > Damon
> >
> > "Coderz" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> The code below perfectly work if it is not located inside a subreport.
> >>
> >> Public Sub Report_Page()
> >> Dim X1, Y1, X2, Y2 As Single
> >> Me.DrawStyle = 0 ' a solid line
> >>
> >> Me.DrawWidth = 1 ' set the thickness of the line
> >>
> >> ' Set the coordinates and draw a line down the middle of the page.
> >>
> >> X1 = 60 'Int(Me.ScaleWidth / 2) ' find the middle of the page
> >> Y1 = Me.Section(1).Height ' start just below the page header
> >> X2 = X1 ' the line is vertical
> >>
> >> ' length of line is the length of the Page - (Height of the
> >> PageHeader + Height of the Page Footer).
> >>
> >> Y2 = Me.ScaleHeight
> >>
> >> Me.Line (X1, Y1)-(X2, Y2) ' This draws the line
> >> Me.Line (955, Y1)-(955, Y2) ' This draws the line
> >> Me.Line (1740, Y1)-(1740, Y2) ' This draws the line
> >> Me.Line (3360, Y1)-(3360, Y2) ' This draws the line
> >> Me.Line (4560, Y1)-(4560, Y2) ' This draws the line
> >> Me.Line (5940, Y1)-(5940, Y2) ' This draws the line
> >> Me.Line (7850, Y1)-(7850, Y2) ' This draws the line
> >> Me.Line (9050, Y1)-(9050, Y2) ' This draws the line
> >> Me.Line (10020, Y1)-(10020, Y2) ' This draws the line
> >> Me.Line (11460, Y1)-(11460, Y2) ' This draws the line
> >> End Sub
> >>
> >> This is code is not executed if under a subreport.
> >>
> >> How could I execute it? I tried to call it like Call
> >> Me.[Service_Record_Details].Report.Report_Page but it gives an error.

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to draw a vertical or horizontal line in Word 2003. sheana Microsoft Word New Users 3 25th May 2008 03:14 PM
draw vertical line to mark today in diagram Florian Demmer Microsoft Excel Misc 1 22nd Jan 2008 01:31 PM
Draw Vertical line in the report Detail section =?Utf-8?B?SXJzaGFkIEFsYW0=?= Microsoft Access Reports 1 14th Aug 2007 01:20 PM
Draw a vertical line =?Utf-8?B?Sk9N?= Microsoft Access 3 3rd Mar 2006 01:18 AM
how to draw a vertical line for sections that can grow =?Utf-8?B?bWhtYWlk?= Microsoft Access Reports 1 12th Aug 2005 09:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:13 PM.