Hot do I Fix the number of records displayed on a report

W

wzb6k5

I have a report that needs to show the top 10 sales opportunities. I have it
setup and it works fine as long as there are actually 10 opportunities that
get returned from the query. The problem is that if only 5 opportunities
happen to exist, it only shows the 5 lines of opportunities. I need it to
show blank lines for the other 5. I have it laid out so it looks like a
table.

The reason this is a problem, is that I actually have 3 different tables
like this on a report one right after another. If one only shows 5 lines,
instead of the 10 I have the space allocated for, it leave a big blank area
in the middle of the report, which does not look good.

Any thoughts/suggestions?
 
D

DM

could you either shrink the design and then select to allow it to grown when
there is 10. it will not have the space then.

however, if you want to see blank detail lines, add five more opportunities
in your form (table) with all details blank except for the key
(autonumber/record number; however you have it set), but if you have that
field on your report, the number will show. this however will show the
reader you are still looking for five more opportunities.

my thoughts, your design!
 
W

wzb6k5

The problem is that I never know how many will be returned. I do know that no
more than 10. Ideally, if there was some way to have my query to return blank
rows for the other 5 in my example, that would be great. I will try the idea
 
D

Duane Hookom

The following code will use the Line method in the On Page event to draw a
specific number of lines in a report. You can change the "20" to your line
count and remove the Me.Print if you don't want numbers.

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 = 20
intLineLeft = 720 '1/2 inch from left margin
intLineWidth = 1440 * 5 '5 inches
intTopMargin = Me.Section(3).Height
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
 

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