Re: Show detail rows in report with or without data using VBA?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"How do I configure this code so that it will effect only the detail
section?" You tell me want doesn't work with the code that I provided. Also
let us know what you might have tried to adjust the code.

--
Duane Hookom
MS Access MVP
--

"Tec92407" <Tec92407@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:53BB50BB-D799-4171-AEA9-52978CA24BA7@xxxxxxxxxxxxxxxx
> Thanks
> Your is a simpler aproach.
>
> My report has a header, detail and footer sections.
> The header and footer always have data. The number of rows containing data
> in the detail section may vary from 1 to 10, but I want 10 rows to always
> be
> printed.
>
> What i want to accomplish is have the header printed, then the detail rows
> followed by a number of empty (filler) rows to complete the detail rows to
> 10, then the footer section.
>
> How do I configure this code so that it will effect only the detail
> section?
>
> thanks
> "Duane Hookom" wrote:
>
>> If you want 10 lines on each page, consider code like the following:
>> Private Sub Report_Page()
>> Dim intRptHeadHeight As Integer
>> Dim intPageHeadHeight As Integer
>> Dim intTopMarg As Integer
>> Dim intDetailHeight As Integer
>> Dim intRecNum As Integer
>> intRptHeadHeight = Me.ReportHeader.Height
>> intPageHeadHeight = Me.Section(3).Height
>> intTopMarg = intRptHeadHeight + intPageHeadHeight
>> intDetailHeight = Me.Section(0).Height
>> For intRecNum = 1 To 10
>> Me.CurrentX = 200
>> Me.CurrentY = intTopMarg + _
>> ((intRecNum - 1) * intDetailHeight)
>> Me.Print intRecNum
>> Me.Line (0, intTopMarg + _
>> (intRecNum * intDetailHeight)) _
>> -Step(Me.Width, 0)
>> Next
>> End Sub
>>
>>
>> --
>> Duane Hookom
>> MS Access MVP
>> --
>>
>> "Tec92407" <Tec92407@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:40A5255D-70A4-439E-B469-372FCE5DC9A3@xxxxxxxxxxxxxxxx
>> >I have a report that has a similar look to an existing paper form. The
>> >paper
>> > form has ten numbered rows of empty line items that are later filled in
>> > with
>> > data as needed. My Access version of this report looks identical to the
>> > paper
>> > form except that the item rows (detail section) only appear if there is
>> > data
>> > (as expected).
>> >
>> > Is there a way to create the report so that the ten empty rows appear
>> > but
>> > get
>> > populated with data as needed? So that the report always shows ten
>> > rows,
>> > either empty or with data?
>> >
>> > I think there is a way withe VBA. If the report has 3 detail records, I
>> > think this is the vba approach I would use (excuse my psuedo code) : -)
>> >
>> > In the "on print" event procedure of the detail section of the report:
>> >
>> > If the record count in the detail section is less than 10
>> > for each field in the detail row
>> > get the property values for the outline of each field
>> > end
>> >
>> > get the detail record count
>> > subtract detail record count from 10
>> >
>> > while count is less than the computed count
>> > for each field in the row
>> > draw each field outline
>> > end
>> > end
>> >
>> > end
>> >
>> > Is this the right approach or is there an easier way to do this?
>> > Anyone have code to share?
>> >
>> > Thanks in advance
>>
>>
>>


.



Relevant Pages

  • Re: Show detail rows in report with or without data using VBA?
    ... Dim intPageHeadHeight As Integer ... >I have a report that has a similar look to an existing paper form. ... > subtract detail record count from 10 ...
    (microsoft.public.access.reports)
  • Re: Dim oRpt As New CrystalReport1() failing
    ... I do not work with strongly typed reports - I create report files ... Dim paramFields As New ParameterFields ... > Dim paramFields As New ParameterFields ... > reference to "Dim oRpt as New CrystalReport(), ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Dim oRpt As New CrystalReport1() failing
    ... I do not work with strongly typed reports - I create report files ... Dim paramFields As New ParameterFields ... > Dim paramFields As New ParameterFields ... > reference to "Dim oRpt as New CrystalReport(), ...
    (microsoft.public.vb.crystal)
  • RE: Custom Print, close, email ribbon
    ... This way, regardless of whether I open the report from code, or via the ... Dim cbr As Object 'As CommandBar ... Dim rpt As Report, strRptName As String ...
    (microsoft.public.access.reports)
  • pausing and resume
    ... hello i am using this code for generating word report, ... Dim appWord As Word.Application ... Dim rowCount As Long ... 'create a table to display the testscript names and their Outcome ...
    (microsoft.public.word.vba.general)