Always Displaying 10 Lines In The Detail Section Of A Report

V

vvwilson

I have a report that looks like an invoice. The detail section is
populated by the employee names that performed work related to that
invoice. The detail section needs to show space for 10 entries. When
I have 10 people working on an invoice I'm okay, however if I have
less that 10 people my report does not show the necessary 10 lines.
How do I create a report that always shows 10 lines in the detail
section?
 
D

Duane Hookom

You haven't what you would expect to see in the extra, blank area of the
report. I assume you want to draw horizontal lines. If this is the case, you
can use code in the On Page event of the report like:
Private Sub Report_Page()
Dim intNumLines As Integer
Dim intLineNumber As Integer
Dim intTopMargin As Integer
Dim ctl As Control
Dim intLineHeight As Integer
Dim intLineLeft As Integer
Dim intLineWidth As Integer
intNumLines = 10
intLineLeft = 720 '1/2 inch from left margin
intLineWidth = 1440 * 5 '5 inches
intTopMargin = Me.Section(3).Height 'page header
intLineHeight = Me.Section(0).Height
Me.FontSize = 14
For intLineNumber = 0 To intNumLines - 1
Me.CurrentX = intLineLeft
Me.CurrentY = intTopMargin + _
(intLineNumber * intLineHeight)
Me.Print intLineNumber + 1
Me.Line (intLineLeft, intTopMargin + _
(intLineNumber * intLineHeight)) _
-Step(intLineWidth, 0)
Next
End Sub
 
V

vvwilson

You haven't what you would expect to see in the extra, blank area of the
report. I assume you want to draw horizontal lines. If this is the case, you
can use code in the On Page event of the report like:
Private Sub Report_Page()
    Dim intNumLines As Integer
    Dim intLineNumber As Integer
    Dim intTopMargin As Integer
    Dim ctl As Control
    Dim intLineHeight As Integer
    Dim intLineLeft As Integer
    Dim intLineWidth As Integer
    intNumLines = 10
    intLineLeft = 720 '1/2 inch from left margin
    intLineWidth = 1440 * 5 '5 inches
    intTopMargin = Me.Section(3).Height 'page header
    intLineHeight = Me.Section(0).Height
    Me.FontSize = 14
    For intLineNumber = 0 To intNumLines - 1
        Me.CurrentX = intLineLeft
        Me.CurrentY = intTopMargin + _
            (intLineNumber * intLineHeight)
        Me.Print intLineNumber + 1
        Me.Line (intLineLeft, intTopMargin + _
            (intLineNumber * intLineHeight)) _
            -Step(intLineWidth, 0)
    Next
End Sub
--
Duane Hookom
Microsoft Access MVP





- Show quoted text -

Duane, thanks for your help! The code worked great. Can you also show
me how to creatate vertical lines and also how do I remove the
numbering from the code you sent me. I am going to need about four
vertical lines so that my finished product looks like a spread sheet.

Thanks,


Van
 
D

Duane Hookom

This code removes the line numbers. You can use the Line method to draw the
vertical lines. I generally use the left property of a control to define the
X property of the vertical line.

Private Sub Report_Page()
Dim intNumLines As Integer
Dim intLineNumber As Integer
Dim intTopMargin As Integer
Dim ctl As Control
Dim intLineHeight As Integer
Dim intLineLeft As Integer
Dim intLineWidth As Integer
intNumLines = 10
intLineLeft = 720 '1/2 inch from left margin
intLineWidth = 1440 * 5 '5 inches
intTopMargin = Me.Section(3).Height 'page header
intLineHeight = Me.Section(0).Height
For intLineNumber = 0 To intNumLines - 1
Me.Line (intLineLeft, intTopMargin + _
(intLineNumber * intLineHeight)) _
-Step(intLineWidth, 0)
Next
End Sub
 
V

vvwilson

This code removes the line numbers. You can use the Line method to draw the
vertical lines. I generally use the left property of a control to define the
X property of the vertical line.

Private Sub Report_Page()
    Dim intNumLines As Integer
    Dim intLineNumber As Integer
    Dim intTopMargin As Integer
    Dim ctl As Control
    Dim intLineHeight As Integer
    Dim intLineLeft As Integer
    Dim intLineWidth As Integer
    intNumLines = 10
    intLineLeft = 720 '1/2 inch from left margin
    intLineWidth = 1440 * 5 '5 inches
    intTopMargin = Me.Section(3).Height 'page header
    intLineHeight = Me.Section(0).Height
    For intLineNumber = 0 To intNumLines - 1
        Me.Line (intLineLeft, intTopMargin + _
            (intLineNumber * intLineHeight)) _
            -Step(intLineWidth, 0)
    Next
End Sub

--
Duane Hookom
Microsoft Access MVP






- Show quoted text -

Thanks,

Van
 
V

vvwilson

Thanks,

Van- Hide quoted text -

- Show quoted text -

Duane, I'm sorry to be a pain, however, I am having no success with
the vertical line. Could you please provide an example.

Thanks,


Van
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top