Multi-Column Report - Add a border and line between columns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know a way to put a border around a report and between the
columns of a multi-column report? I tried just adding the lines in the
report detail and it did not give a line on the far right side plus the
border was not complete if there were not enough records to fill the whole
page.

Thanks in advance,
John
 
You can add code like:
Private Sub Report_Page()
Dim intLineCount As Integer
Dim intColumnWidth As Integer
Dim intReportHeight As Integer
intReportHeight = (9 * 1440)
intColumnWidth = 2800
For intLineCount = 0 To 4
Me.Line (intLineCount * intColumnWidth, 0)-Step(0, intReportHeight)
Next
Me.Line (0, 0)-Step(4 * intColumnWidth, intReportHeight), , B
End Sub
 
This works perfectly except I am confused on how I can make the rectangle
move down about an inch. I can't seem to figure that out. Any help would be
great.

Thanks in advance
 
Private Sub Report_Page()
Dim intLineCount As Integer
Dim intColumnWidth As Integer
Dim intReportHeight As Integer
Dim intLineTop as Integer
intLineTop = 1440
intReportHeight = (9 * 1440)
intColumnWidth = 2800
For intLineCount = 0 To 4
Me.Line (intLineCount * intColumnWidth, intLineTop)-Step(0,
intReportHeight)
Next
Me.Line (0, intLineTop)-Step(4 * intColumnWidth, intReportHeight), , B
End Sub
 
Thanks for the code. It works great vertically.

In my situation, I also want to put horizontal lines. Basically, I want to
use lines to separate a table of records in the report, similar to an excel
table. As of now, I use the line icon in the tool box.

It will be nice to learn a smarter way. Thank you in advance.

james
 
Add code to the On Print event of the detail section to draw a horizontal
line at the bottom of the section.
 
Thanks Duane. I was sucessful in putting the horizontal line by code.

Me.Line(0,Me.Height)-Step(Me.Width,0),vbBlack

But it only draw a horizontal line at the bottom. Did I do something wrong?

I was seeking a way by code, to line horizontally each columnar report
record (I have 17 of these text boxes in each column of 5 columns).

This is similar to the post by Bill at
"http://www.accessmonster.com/Uwe/Fo...orts-with-a-horizontal-line-after-each-record".
However, I wasn't able to view the code solution in his post.

Currently, I am using the line icon to put them in place line by line. It
works OK. But a code solution will be better.

Thank you in advance for your advice.

james
 
Sorry. I put it in the Objects-Reports-RptTest-Detail section-On Print event.
RptTest is my test report name.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Me.Line (0, Me.Height)-Step(Me.Width, 0), vbBlack
End Sub

Thank you.

james
 
The horizontal line should be printed at the bottom of each detail section
(my results). Isn't this what you wanted?
 
Hello Duane:

This may be a double reply. I did one last night, but do not see it posted
as of now, my apology for any duplication.

Yes, the lines (m-n, per diagram below) are there at the bottom of the
section. But what I had in mind was to draw horizontal lines across
underneath each record like lines c-d, e-f..., k-l.

a _____________________________________________ b
| | Col-1 | Col-2 | Col-3 | Col-4 |
c |_________ |________| ________|________|_______| d
| Record-1 | | | | |
e |_________ |________| ________|________|_______| f
| Record-2 | | | |
|
g |_________ |________| ________|________|_______| h
| To… | | | |
|
i |_________ |________| ________|________|_______| j
| Record-16 | | | |
|
k |_________ |________| ________|________|_______| l
| Record-17 | | | |
|
m |_________ |________| ________|________|_______| n


At the moment, I achieved this grid table by using the line icon. I drew one
line under each record. It will be nice to do it by code.

Thanks.

James
 
The code I suggested does place a line at the bottom of each record/detail
section. What are your results with using the code? What do you want changed
from your results?
 
I found the reason as to why we had different results. The lines were there
if I were to create the report in tabular format.

However, I made my report in columnar format and limited the number of rows
displayed. Consequently, I had only one line drew at the bottom. %-((

I had to use the columnar format because I had 17 fields to display. The
page wouldn't have the length if I were to display it tabularly. The 4
columns to the right of the far left fields / labels would in fact be
records. Didn't mean to confuse the terms of fields and records. Never
thought of it along that perspective.

What I did then, was in fact drawing lines underneath the fields / labels on
the far left column to grid my report. What I was seeking then was a way to
code in the lines underneath the fields / labels instant of using the line
icon.

james
 
You can use code in the On Print event to loop through all controls in the
detail section and draw lines beginning from
(ctl.Left, ctl.Top+ctl.Height) - Step(ctl.Width,0)
 
Back
Top