WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Help with drawing horizontal line in Access subreport 2003

 
Goto page 1, 2, 3
   Home -> Office other -> Reports RSS
Next:  Cannot Change Report Page Size Access 2007  
Author Message
jeremy.wy.chong

External


Since: Jul 20, 2008
Posts: 10



(Msg. 1) Posted: Sun Jul 20, 2008 7:07 pm
Post subject: Help with drawing horizontal line in Access subreport 2003
Archived from groups: microsoft>public>access>reports (more info?)

Hi,
Ok in a nutshell I need to draw a horizontal line at the bottom of
each page. Now I followed this thread
http://groups.google.co.nz/group/microsoft.public.access.reports/brows...hread/t
but the problem is that this is used in a subreport so the page footer
is not executed!

The ways of thought I have gone about (but not known how to execute)
are as follows:
1. If detail row is last detail row on page then draw a horizontal
line. PROBLEM: how can I tell if it is the last detail row on the
page?
OR
2. Use the above thread example PROBLEM: report_page event does not
fire in a subreport so need to find alternative event????

I have already trawled the net for answers with no real luck so this
is my last resort! Any help would be greatly appreciated.
Back to top
Login to vote
Marshall Barton

External


Since: Dec 07, 2003
Posts: 6121



(Msg. 2) Posted: Mon Jul 21, 2008 6:50 am
Post subject: Re: Help with drawing horizontal line in Access subreport 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

jeremy.wy.chong.TakeThisOut@gmail.com wrote:
>Ok in a nutshell I need to draw a horizontal line at the bottom of
>each page. Now I followed this thread
>http://groups.google.co.nz/group/microsoft.public.access.reports/browse_thread/thread/78f430839b0c12a6
>but the problem is that this is used in a subreport so the page footer
>is not executed!
>
>The ways of thought I have gone about (but not known how to execute)
>are as follows:
>1. If detail row is last detail row on page then draw a horizontal
>line. PROBLEM: how can I tell if it is the last detail row on the
>page?
>OR
>2. Use the above thread example PROBLEM: report_page event does not
>fire in a subreport so need to find alternative event????


Subreports are unaware of page boundaries because the main
report is "in charge" of pages.

If you really want a line at the bottom of **every** page,
put a line control in the main report's page footer section.

If you only want a line at the bottom of the subreport's
last detail, out a text box (named txtDtlCnt) in the
subreport's report header section and set it's control
source to =Count(*)

Add a line control (named linLast) to the bottom of the
detail section.

Then add a text box (named txtDetail) to the subreport's
detail section. Set its control source to =1 and RunningSum
to Over All. Then you can use code in the detail section
Format event procedure to make the line control visible or
not with this kind of code:

Me.linLast.Visible = (txtDetail=txtDtlCnt)

--
Marsh
MVP [MS Access]
Back to top
Login to vote
jeremy.wy.chong

External


Since: Jul 20, 2008
Posts: 10



(Msg. 3) Posted: Mon Jul 21, 2008 12:28 pm
Post subject: Re: Help with drawing horizontal line in Access subreport 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Brendan and Marsh, thank you for your input. I just want a line at
the bottom of each page in the subreport, not all pages in the main
report! The reason why I need to do this is that in the subreport I
have drawn borders around detail rows based on cells not being
repeated (ie. some columns in my dataset have lots of repeating rows
so I turn hideduplicates on and draw borders accordingly). The problem
with this is that it doesn't draw a border on the last detail row on
the page because the columns are still repeating data (and therefore
not drawing a horizontal line). This is my code, perhaps it could be
modified to be a bit smarter???

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

On Error Resume Next
Dim lngCounter As Long, dblMaxHeight As Double
dblMaxHeight = 0
ReDim strcontrol(6)
'SET CONTROLS
strcontrol(0) = "Team_Title"
strcontrol(1) = "LoS_Description"
strcontrol(2) = "action_description"
strcontrol(3) = "measure_description"
strcontrol(4) = "Source_Name"
'GET HEIGHT OF TALLEST CONTROL
For lngCounter = 0 To UBound(strcontrol)
If Me(strcontrol(lngCounter)).Height > dblMaxHeight Then dblMaxHeight
= Me(strcontrol(lngCounter)).Height
Next

For lngCounter = 0 To UBound(strcontrol) - 1
If strcontrol(lngCounter) = "measure_description" Then
'DRAW BOX BECAUSE THIS IS NEVER REPEATED
Me.Line (Me(strcontrol(lngCounter)).Left,
Me(strcontrol(lngCounter)).Top)-Step(Me(strcontrol(lngCounter)).Width,
dblMaxHeight), , B
Else
'DRAW HORIZONTAL LINE
Me.Line (Me(strcontrol(lngCounter)).Left,
Me(strcontrol(lngCounter)).Top)-Step(5, dblMaxHeight), , B
End If
Next


If previous_los.Caption <> LoS_Description Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![LoS_Description].Left, Me![LoS_Description].Top)-
Step(Me![LoS_Description].Width, 5), , B
End If
previous_los.Caption = LoS_Description

If previous_action.Caption <> Action_Description Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![Action_Description].Left, Me!
[Action_Description].Top)-Step(Me![Action_Description].Width, 5), , B
End If
previous_action.Caption = Action_Description

If previous_source_name.Caption <> Source_Name Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![Source_Name].Left, Me![Source_Name].Top)-Step(Me!
[Source_Name].Width, 5), , B
End If
previous_source_name.Caption = Source_Name

If previous_team_title.Caption <> Team_Title Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![Team_Title].Left, Me![Team_Title].Top)-Step(Me!
[Team_Title].Width, 5), , B
End If
previous_team_title.Caption = Team_Title

Me.Line (Me![Source_Name].Left + Me![Source_Name].Width, Me!
[Source_Name].Top)-Step(5, dblMaxHeight), , B

Me.txtbottom = Me.Top + Me.Height - MARGIN

End Sub
Back to top
Login to vote
Brendan Reynolds

External


Since: May 04, 2005
Posts: 1919



(Msg. 4) Posted: Mon Jul 21, 2008 12:31 pm
Post subject: Re: Help with drawing horizontal line in Access subreport 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

<jeremy.wy.chong.RemoveThis@gmail.com> wrote in message
news:343d812c-8971-464b-a7b2-3c29fae3792c@w39g2000prb.googlegroups.com...
> Hi,
> Ok in a nutshell I need to draw a horizontal line at the bottom of
> each page. Now I followed this thread
> http://groups.google.co.nz/group/microsoft.public.access.reports/brows...hread/t
> but the problem is that this is used in a subreport so the page footer
> is not executed!
>
> The ways of thought I have gone about (but not known how to execute)
> are as follows:
> 1. If detail row is last detail row on page then draw a horizontal
> line. PROBLEM: how can I tell if it is the last detail row on the
> page?
> OR
> 2. Use the above thread example PROBLEM: report_page event does not
> fire in a subreport so need to find alternative event????
>
> I have already trawled the net for answers with no real luck so this
> is my last resort! Any help would be greatly appreciated.


A subreport doesn't have pages, so you can't do anything for each page in a
subreport. They just don't exist. It's the containing report that has pages.
What is it that you're trying to do that can't be done by placing the line
in the page footer of the containing report?

--
Brendan Reynolds
Back to top
Login to vote
jeremy.wy.chong

External


Since: Jul 20, 2008
Posts: 10



(Msg. 5) Posted: Mon Jul 21, 2008 12:31 pm
Post subject: Re: Help with drawing horizontal line in Access subreport 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Brendan and Marsh, thank you for your input. I just want a line at
the bottom of each page in the subreport, not all pages in the main
report! The reason why I need to do this is that in the subreport I
have drawn borders around detail rows based on cells not being
repeated (ie. some columns in my dataset have lots of repeating rows
so I turn hideduplicates on and draw horizonal lines accordingly). The
problem
with this is that it doesn't draw a horizontal line on the last detail
row on
the page because the columns are still repeating data (and therefore
not drawing a horizontal line). This is my code, perhaps it could be
modified to be a bit smarter???

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


On Error Resume Next
Dim lngCounter As Long, dblMaxHeight As Double
dblMaxHeight = 0
ReDim strcontrol(6)
'SET CONTROLS
strcontrol(0) = "Team_Title"
strcontrol(1) = "LoS_Description"
strcontrol(2) = "action_description"
strcontrol(3) = "measure_description"
strcontrol(4) = "Source_Name"
'GET HEIGHT OF TALLEST CONTROL
For lngCounter = 0 To UBound(strcontrol)
If Me(strcontrol(lngCounter)).Height > dblMaxHeight Then dblMaxHeight
= Me(strcontrol(lngCounter)).Height
Next


For lngCounter = 0 To UBound(strcontrol) - 1
If strcontrol(lngCounter) = "measure_description" Then
'DRAW BOX BECAUSE THIS IS NEVER REPEATED
Me.Line (Me(strcontrol(lngCounter)).Left,
Me(strcontrol(lngCounter)).Top)-
Step(Me(strcontrol(lngCounter)).Width,
dblMaxHeight), , B
Else
'DRAW HORIZONTAL LINE
Me.Line (Me(strcontrol(lngCounter)).Left,
Me(strcontrol(lngCounter)).Top)-Step(5, dblMaxHeight), , B
End If
Next


If previous_los.Caption <> LoS_Description Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![LoS_Description].Left, Me![LoS_Description].Top)-
Step(Me![LoS_Description].Width, 5), , B
End If
previous_los.Caption = LoS_Description


If previous_action.Caption <> Action_Description Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![Action_Description].Left, Me!
[Action_Description].Top)-Step(Me![Action_Description].Width, 5), , B
End If
previous_action.Caption = Action_Description


If previous_source_name.Caption <> Source_Name Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![Source_Name].Left, Me![Source_Name].Top)-Step(Me!
[Source_Name].Width, 5), , B
End If
previous_source_name.Caption = Source_Name


If previous_team_title.Caption <> Team_Title Then
'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
Me.Line (Me![Team_Title].Left, Me![Team_Title].Top)-Step(Me!
[Team_Title].Width, 5), , B
End If
previous_team_title.Caption = Team_Title


Me.Line (Me![Source_Name].Left + Me![Source_Name].Width, Me!
[Source_Name].Top)-Step(5, dblMaxHeight), , B



End Sub
Back to top
Login to vote
Marshall Barton

External


Since: Dec 07, 2003
Posts: 6121



(Msg. 6) Posted: Mon Jul 21, 2008 4:19 pm
Post subject: Re: Help with drawing horizontal line in Access subreport 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

jeremy.wy.chong DeleteThis @gmail.com wrote:

>Hi Brendan and Marsh, thank you for your input. I just want a line at
>the bottom of each page in the subreport, not all pages in the main
>report! The reason why I need to do this is that in the subreport I
>have drawn borders around detail rows based on cells not being
>repeated (ie. some columns in my dataset have lots of repeating rows
>so I turn hideduplicates on and draw borders accordingly). The problem
>with this is that it doesn't draw a border on the last detail row on
>the page because the columns are still repeating data (and therefore
>not drawing a horizontal line). This is my code, perhaps it could be
>modified to be a bit smarter???
>
>Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
>
>On Error Resume Next
>Dim lngCounter As Long, dblMaxHeight As Double
>dblMaxHeight = 0
>ReDim strcontrol(6)
>'SET CONTROLS
>strcontrol(0) = "Team_Title"
>strcontrol(1) = "LoS_Description"
>strcontrol(2) = "action_description"
>strcontrol(3) = "measure_description"
>strcontrol(4) = "Source_Name"
>'GET HEIGHT OF TALLEST CONTROL
>For lngCounter = 0 To UBound(strcontrol)
>If Me(strcontrol(lngCounter)).Height > dblMaxHeight Then dblMaxHeight
>= Me(strcontrol(lngCounter)).Height
>Next
>
>For lngCounter = 0 To UBound(strcontrol) - 1
> If strcontrol(lngCounter) = "measure_description" Then
> 'DRAW BOX BECAUSE THIS IS NEVER REPEATED
> Me.Line (Me(strcontrol(lngCounter)).Left,
>Me(strcontrol(lngCounter)).Top)-Step(Me(strcontrol(lngCounter)).Width,
>dblMaxHeight), , B
> Else
> 'DRAW HORIZONTAL LINE
> Me.Line (Me(strcontrol(lngCounter)).Left,
>Me(strcontrol(lngCounter)).Top)-Step(5, dblMaxHeight), , B
> End If
>Next
>
>
>If previous_los.Caption <> LoS_Description Then
>'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
> Me.Line (Me![LoS_Description].Left, Me![LoS_Description].Top)-
>Step(Me![LoS_Description].Width, 5), , B
>End If
>previous_los.Caption = LoS_Description
>
>If previous_action.Caption <> Action_Description Then
>'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
> Me.Line (Me![Action_Description].Left, Me!
>[Action_Description].Top)-Step(Me![Action_Description].Width, 5), , B
>End If
>previous_action.Caption = Action_Description
>
>If previous_source_name.Caption <> Source_Name Then
>'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
> Me.Line (Me![Source_Name].Left, Me![Source_Name].Top)-Step(Me!
>[Source_Name].Width, 5), , B
>End If
>previous_source_name.Caption = Source_Name
>
>If previous_team_title.Caption <> Team_Title Then
>'CONTROL TEXT IS NOT DUPLICATE SO DRAW HORIZONTAL LINE TO SIGNIFY BOX
> Me.Line (Me![Team_Title].Left, Me![Team_Title].Top)-Step(Me!
>[Team_Title].Width, 5), , B
>End If
>previous_team_title.Caption = Team_Title
>
> Me.Line (Me![Source_Name].Left + Me![Source_Name].Width, Me!
>[Source_Name].Top)-Step(5, dblMaxHeight), , B
>
>Me.txtbottom = Me.Top + Me.Height - MARGIN
>
>End Sub


Saving a field's value from a previous and the comparing it
to the field's value in the current record is not a safe
approach to anything in a report. The reason it's not safe
is because a report may have to retreat and reformat any
number of sections in any order to deal with various
combinations of options such as Pages, the different kinds
of KeepTogether, forceNewPage, etc. This may or may not be
related to your question, but it will cause you problems
sometime/somewhere.

In your situation, I think you can use the IsVisible
property to determine if a text box is a hidden duplicate or
not. Using it should also make your code a lot easier to
write and understand.

It's also possible that the line that's not showing is just
below the bottom of the section. Try subtracting 10 or 20
from the max height part of the Line method.

--
Marsh
MVP [MS Access]
Back to top
Login to vote
jeremy.wy.chong

External


Since: Jul 20, 2008
Posts: 10



(Msg. 7) Posted: Mon Jul 21, 2008 7:52 pm
Post subject: Re: Help with drawing horizontal line in Access subreport 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Marshall,
Thank you for your input about the IsVisible. It makes my code much
easier and efficient!

As for the the horizontal line, I tried changing the max height but it
doesn't work. The fact is that the line is not drawn because the last
detail row on the page is a duplicate! So therefore I really need some
sort of workaround to draw a line at the bottom of each subreport page
OR I need to rework my entire method of drawing the lines (which I do
not want to do).
Back to top
Login to vote
Marshall Barton

External


Since: Dec 07, 2003
Posts: 6121



(Msg. 8) Posted: Tue Jul 22, 2008 8:49 am
Post subject: Re: Help with drawing horizontal line in Access subreport 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

jeremy.wy.chong DeleteThis @gmail.com wrote:
>Thank you for your input about the IsVisible. It makes my code much
>easier and efficient!
>
>As for the the horizontal line, I tried changing the max height but it
>doesn't work. The fact is that the line is not drawn because the last
>detail row on the page is a duplicate! So therefore I really need some
>sort of workaround to draw a line at the bottom of each subreport page
>OR I need to rework my entire method of drawing the lines (which I do
>not want to do).


Did you try using the =Count(*) and =1 text boxes I
suggested earlier? The general idea should still apply even
if you need to draw the line in code.

--
Marsh
MVP [MS Access]
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> Reports All times are: Eastern Time (US & Canada) (change)
Goto page 1, 2, 3
Page 1 of 3

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET