Show grid on report

G

Guest

Hi,
Is there any way to show a grid in a report? Rigth now my report is showing
a grid where there is data (detail). I need to "fill up" the rest of the
space so when the report is printed it would show the information inside a
grid with more lines to be fill up manually.

Thanks in advance
 
D

Duane Hookom

You can remove the borders of all your controls and use the Line method in
the On Page event.
This code will draw 24 rectangles on your report that are the same height as
your detail section.

Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
Dim intDetailHeight As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
For intLoop = 0 To intRows
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub
 
G

Guest

Duane,
thanks so much for your great solution. Now, I have one more question.
How do you show the grid in a sub-report?
It shows on print preview and prints with no problem in a simple report.
When I use the same report as a subreport, it doesn't work.

Am I missing something?
Thanks in advance,
 
D

Duane Hookom

Subreports will never show if their record source returns no records. Is
this your issue?
 
G

Guest

yes. I would like to have always 12 rows on each page, data or Null values.
Is it possible?
 
D

Duane Hookom

You will need to set the subreport size to fixed dimensions and not allow it
to shrink or grow. Try set the background of the subreport control to
transparent. Use code in the On Format event of the main report section
containing the subreport to draw the lines.

I'm not sure if this will work or not. I do know that a subreport doesn't
have Page events or sections so attempting to draw lines from the On Page
event of a subreport will be ignored.
 

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