Rabu, 23 Mei 2012

Re: [MS_AccessPros] Re: Gaps between sub-reports when Border is larger than hairline (Access 2007)

 

Calvin, John, Bill,

Tests conducted at my end reveal that the reported anomaly (in print preview) is encountered on Access 2003 as well as 2010. The problem is apparently related to marginal inward shrinkage of a subreport control on being assigned a solid border. The effect becomes more pronounced with heavier border thickness.

For ready visual appreciation, if one of two identically sized subreport controls is assigned a thick border while the other one has hairline border, it would be observed that on opening in print preview, the control with thicker border has shrunk in width as well as height as compared to the other one.

For meeting Calvin's objective of enclosing the two subreports within a thick common border, accompanied by a thin horizontal line separating the two subreports, adoption of report's Line method could be considered.

Sample code in report's module, as given below, should get the desired results.

Best wishes,
A.D. Tejpal
------------

' Code in report's module
' SR_A & SR_B are the names of two subreport
' controls placed one below the other (SR_A at top)
' It is presumed that a margin of at least 30 twips is
' available between these controls and the report edges.
'================================
Private Sub Detail_Print(Cancel As Integer, _
PrintCount As Integer)
Dim XTopLf As Long, YTopLf As Long
Dim XBotRt As Long, YBotRt As Long
Dim YMid As Long

Me.DrawMode = 1
Me.DrawStyle = 0

XTopLf = Me.SR_A.Left - 30
YTopLf = Me.SR_A.Top - 30
XBotRt = Me.SR_B.Left + Me.SR_B.Width + 30
YBotRt = Me.SR_B.Top + Me.SR_B.Height + 30
YMid = Me.SR_A.Top + Me.SR_A.Height + _
(Me.SR_B.Top - _
(Me.SR_A.Top + Me.SR_A.Height)) \ 2

' Draw thick common border enclosing the two subreports
Me.DrawWidth = 16
Me.Line (XTopLf, YTopLf)-(XBotRt, YBotRt), 0, B

' Draw thin horizontal dividing line between the two subreports
Me.DrawWidth = 4
Me.Line (XTopLf, YMid)-(XBotRt, YMid)
End Sub
'================================

----- Original Message -----
From: John Viescas
To: MS_Access_Professionals@yahoogroups.com
Sent: Tuesday, May 22, 2012 22:29
Subject: RE: [MS_AccessPros] Re: Gaps between sub-reports when Border is larger than hairline (Access 2007)

Calvin-

You can't do it in the Print event. You can only do it in the Format event, but
you have to calculate the height of the first subreport yourself (based on
looking at the recordset). Then set the height of the first subreport (Can Grow
= No) and move down the remaining controls as necessary, leaving a slight
overlap between the first and second subreport to get rid of the gap.

John Viescas, author

Microsoft Office Access 2010 Inside Out

Microsoft Office Access 2007 Inside Out

Building Microsoft Access Applications

Microsoft Office Access 2003 Inside Out

SQL Queries for Mere Mortals

<http://www.viescas.com/> http://www.viescas.com/

(Paris, France)

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of c.krusen1
Sent: Tuesday, May 22, 2012 6:08 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Gaps between sub-reports when Border is larger than
hairline (Access 2007)

John - Thanks for that workaround. However, I am getting a:

'The setting you entered isn't valid for this property'

error. What's up with that?

--- In MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> , John Viescas <JohnV@...>
wrote:
>
> Calvin-
>
>
>
> See my slightly earlier reply for an ugly workaround. No, an element cannot
> span multiple sections in an Access report.
>
>
>
> John Viescas, author
>
> Microsoft Office Access 2010 Inside Out
>
> Microsoft Office Access 2007 Inside Out
>
> Building Microsoft Access Applications
>
> Microsoft Office Access 2003 Inside Out
>
> SQL Queries for Mere Mortals
>
> <http://www.viescas.com/> http://www.viescas.com/
>
> (Paris, France)
>
>
>
>
>
>
>
> From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of c.krusen1
> Sent: Tuesday, May 22, 2012 5:23 PM
> To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> Subject: [MS_AccessPros] Re: Gaps between sub-reports when Border is larger
than
> hairline (Access 2007)
>
>
>
>
>
> Thanks for confirming it. Now how about a solution/workaround?
>
> I figured I would try turning the borders of the sub-reports off, and creating
> them in the subs themselves. I put a 2pt wide vertical line from 0,0 to
> 0,(detail ht). But I can't figure out how to make the line grow as the detail
> section grows. The cangrow only effects elements with related data (or their
> containers, like a detail section).
>
> Crystal Reports has a feature that allows an element to span multiple
sections.
> For example a line could go from the header to the footer, and would grow in
> length as the detail section grows.
>
> Does Access such a feature?
>
> --- In MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> <mailto:MS_Access_Professionals%40yahoogroups.com> , John Viescas <JohnV@>
> wrote:
> >
> > Calvin-
> >
> >
> >
> > Ah, I see it. I've just uploaded some sample screen dumps into
> > 2_AssistanceNeeded. Report View is even weirder with 2pt borders. The thick
> > border appears around both subreports with a thin border separating them,
and
> > bogus horizontal scroll bars show up!
> >
> >
> >
> > I think I'll report it.
> >
> >
> >
> > John Viescas, author
> >
> > Microsoft Office Access 2010 Inside Out
> >
> > Microsoft Office Access 2007 Inside Out
> >
> > Building Microsoft Access Applications
> >
> > Microsoft Office Access 2003 Inside Out
> >
> > SQL Queries for Mere Mortals
> >
> > <http://www.viescas.com/> http://www.viescas.com/
> >
> > (Paris, France)
> >
> >
> >
> > From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> > [mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of c.krusen1
> > Sent: Tuesday, May 22, 2012 4:40 PM
> > To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> > Subject: [MS_AccessPros] Re: Gaps between sub-reports when Border is larger
> than
> > hairline (Access 2007)
> >
> >
> >
> >
> >
> > 2007 (I put it in the subject, but it got clipped)
> >
> > Imagine I have rptMain, rptSub1, and rptSub2. The subs are in the main
report.
> >
> > rptSub1.top=0, .left=0, .width=4, .height=1.0, .cangrow=yes, .canshrink=yes,
> > .borderstyle=solid, .borderwidth=2pt
> >
> > rptSub2's properties are identical to rptSub1, but with it's top=1.0.
> >
> > The rptSub2 moves appropriately as rptSub1 grows, but the gap between the
two
> is
> > constant (unless I set the border width to hairline).
> >
> > Setting rptSub2.top to anything other than 0.5, and the relative position
> > between the tow subs is lost.
> >
> > Calvin
> >
> > --- In MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com> , "Bill Mosca" <wrmosca@>
> > wrote:
> > >
> > > Calvin
> > >
> > > What version of Access are you using? I just tested in 2003 and the border
> > width does not affect the layout.
> > >
> > > Regards,
> > > Bill Mosca, Founder - MS_Access_Professionals
> > > http://www.thatlldoit.com
> > > Microsoft Office Access MVP
> > > https://mvp.support.microsoft.com/profile/Bill.Mosca
> > >
> > >
> > >
> > > --- In MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com> , "c.krusen1"
<c.krusen1@>
> > wrote:
> > > >
> > > > There seems to be a gap between sub-reports that grows with the
> sub-report's
> > border size. When it is set to hairline, the gap is not perceivable. But
with
> > larger sizes, it gets ugly.
> > > >
> > > > It's easily demonstrated. Just make a report, put two sub reports in it,
> > align the sub-reports, set their borders to hairline and print preview. Then
> > change the sub-reports' borders to 2pt and print preview again.
> > > >
> > > > I've played with the various parameters of the sub-reports (padding,
> setting
> > the Top value of the lower sub to just under the height of upper one, etc..)
> > with no success.
> > > >
> > > > Anyone run into this, or have any solutions?
> > > >
> > > > Thanks in advance.
> > > >
> > > > Calvin

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar