In my detail section, I sometimes have 2 records under the header and
sometimes up to 30. Is there a way to make sure when there are only 2
records that they are grouped with the header on a page, but if there are
more than 2, then they are allowed to print on a new page? Keep
Together|Whole Group leaves too much blank spaces when it forces a new page
when many records under the detail section, and Keep Together|WithFirstDetail
often splits the records when only 2. I'm needing a hybred between the two.
Thanks, Jeff
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200705/1
|
|
0
|
|
|
|
Reply
|
prairiewind
|
5/23/2007 12:32:30 PM |
|
prairiewind via AccessMonster.com wrote:
>In my detail section, I sometimes have 2 records under the header and
>sometimes up to 30. Is there a way to make sure when there are only 2
>records that they are grouped with the header on a page, but if there are
>more than 2, then they are allowed to print on a new page? Keep
>Together|Whole Group leaves too much blank spaces when it forces a new page
>when many records under the detail section, and Keep Together|WithFirstDetail
>often splits the records when only 2. I'm needing a hybred between the two.
I've been thinking about this question since it was posted
and came to these conclusions.
If either the group header or the detail section can grow,
then I don't think this is possible. The group header would
need to do something in its Format event based on the final
height of the header and the first two details, but the
final height is not known until the second detail's Print
event. This kind of situation requires a partial,
multi-pass operation (retreat) that can not be controlled
through the report design capabilities.
OTOH, if none of these sections can grow, then it can be
done by adding a page break control (named pgBreak) to the
top of the group header section. To determine the number of
details, add a text box (named txtDetailCount) with the
control source expression =Count(*) to the group header.
Then you can use this kind of code to make the page break
visible or not depending the remaining space on the page:
Private Sub GroupHeader0_Format(Cancel As Integer, _
FormatCount As Integer)
Dim intdtl As Integer
intdtl = IIf(txtDetailCount > 2, 2, txtDetailCount)
Me.pgBreak.Visible = (Me.Top + Me.Section(5).Height _
+ intdtl * Me.Section(0).Height) _
> (11 * 1440 - Me.Section(4).Height _
- Me.Printer.BOTTOMMARGIN)
End Sub
* 11 is the paper height in inches
* 1440 is the number of twips per inch
* drop the - Me.Section(4).Height term if there is no page
footer section
--
Marsh
MVP [MS Access]
|
|
0
|
|
|
|
Reply
|
Marshall
|
5/25/2007 5:57:52 PM
|
|
Sorry if this is a double posted reply. Thanks Marshall for your solution
which worked great. I don't like to post a question unless I've first
searched for the answer, but couldn't find where anyone else has run into
this problem. All I needed to do was to change the page size! I've exported
the report to Word for a couple of years to get the formatting correct along
with to make an index, but thanks to this forum, both problems are fixed.
Thanks for all your thought and effort.
Marshall Barton wrote:
>>In my detail section, I sometimes have 2 records under the header and
>>sometimes up to 30. Is there a way to make sure when there are only 2
>[quoted text clipped - 3 lines]
>>when many records under the detail section, and Keep Together|WithFirstDetail
>>often splits the records when only 2. I'm needing a hybred between the two.
>
>I've been thinking about this question since it was posted
>and came to these conclusions.
>
>If either the group header or the detail section can grow,
>then I don't think this is possible. The group header would
>need to do something in its Format event based on the final
>height of the header and the first two details, but the
>final height is not known until the second detail's Print
>event. This kind of situation requires a partial,
>multi-pass operation (retreat) that can not be controlled
>through the report design capabilities.
>
>OTOH, if none of these sections can grow, then it can be
>done by adding a page break control (named pgBreak) to the
>top of the group header section. To determine the number of
>details, add a text box (named txtDetailCount) with the
>control source expression =Count(*) to the group header.
>
>Then you can use this kind of code to make the page break
>visible or not depending the remaining space on the page:
>
>Private Sub GroupHeader0_Format(Cancel As Integer, _
> FormatCount As Integer)
>Dim intdtl As Integer
>
> intdtl = IIf(txtDetailCount > 2, 2, txtDetailCount)
>
> Me.pgBreak.Visible = (Me.Top + Me.Section(5).Height _
> + intdtl * Me.Section(0).Height) _
> > (11 * 1440 - Me.Section(4).Height _
> - Me.Printer.BOTTOMMARGIN)
>End Sub
>
>* 11 is the paper height in inches
>* 1440 is the number of twips per inch
>* drop the - Me.Section(4).Height term if there is no page
>footer section
>
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200705/1
|
|
0
|
|
|
|
Reply
|
prairiewind
|
5/26/2007 5:21:56 AM
|
|
|
2 Replies
180 Views
(page loaded in 0.484 seconds)
Similiar Articles: Detail in form goes blank - microsoft.public.access.formscoding ...... in the detail section on. I do have: Allow ... not read-only (i.e. new >records ... bday_print_click()") >80 Else >90 Call MsgBox("End of Records!! Making one record read-only - microsoft.public.access.forms ...I want to only allow the user to enter one new item and ... formscoding - page 82 Add New Record / Make Existing Records Read Only Utf 2 ... report How can I print only one record ... Printing extra page - microsoft.public.vb.general.discussion ...Else FR.chrg.cpMin ... or more vbCrLf being the /only/ thing left to print on the new page ... On most printers it is only when you want margins of less ... Query a non-MS/non-Active Directory LDAP Server - microsoft.public ...... Debug.Print objIADS.ADSPath Set cnnAD = New ADODB.Connection ... strDNCValue & """" Else Debug.Print ... After that, it is only a question ... SBS2003 R2 to SBS 2003 - to swing or not to swing.... - microsoft ...... as long as that requires 20 hrs or less ... If you use backup MX records or a typical ... service pack and configuration details are addressed on a clean new machine ... accdb vs adp - microsoft.public.accessAt one time, the Access Product Group at ... back end, in which the DBA would allow ... is a result of changes made to ACE (the new JET) engine. Users of ADP can only ... Is there a way to convert a .TIF file in VB6 - microsoft.public.vb ...Because they both allow the OP to ... format using Wiaaut.dll, it only keeps the first page in ... TIFF file into ... that any new code be already there so there's less to ... Parsing CSV files - microsoft.public.vc.mfcOf course the devil is in the details and it helps ... CInt(flds.Item(i))) Else ... just wanted to add, yes, \n is viewed as a new line, but that is only ... BSOD-Unmountable & others - microsoft.public.windowsxp.general ...Please describe this CD *in detail*! I just re-read ... Certain PCs allow you to choose a boot device without ... This is way you have a record of them in case you ever ... Expert Techniques for Crystal Reports... of an if-then-else ... that evaluate only the most recent record in a group. ... and still allow for drill-down 82. Suppress headings on the last page if there are no Details Filter: Limit the number of records in a view or report - Access ...... they allow you to display only the records ... or print only ... show only the New, Delete, Save, Undo, and Help buttons on the record navigation toolbar. When you create a group ... Sorting Records... print at the bottom of the page even if the detail records stop ... every new group. You could also calculate it only ... allow modifying the sort order of detail records. Expression Examples (Report Builder and SSRS)You can refer to only one report item per expression in a page ... the groups or detail records you want, add a page break to the group, and ... Return Nothing Else if ... Selecting RecordsThis is discussed in more detail later in the chapter. Creating a new ... An Exclusive group only allows one ... sometimes the user will want to print every record ... 7/13/2012 10:29:18 PM
|