Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing lines on a report 2

Status
Not open for further replies.

NCYankee1

Programmer
Mar 27, 2001
66
0
0
US
How would I go about drawing a line after every 3rd detail line? It should look like this:

detail-line-1
detail-line-2
detail-line-3
-----------------------------------------
detail-line-4
detail-line-5
detail-line-6
-----------------------------------------
etc etc etc

Thanks!
 
Add an unbound control to your report in the section with the lines, set it's ControlSource to "=1", and set the running sum to "Over All". Name the control txtCounter. Add a line to the detail section of the report at the bottom, I'll call the line object "MyLineName". In the OnFormat event of the section where MyLineName is (most likely the detail section) put this code:

If txtCounter Mod 3 = 0 Then
MyLineName.Visible = True
Else
MyLineName.Visible = False
End If

Now once you've verified that it's working, you can set txtCounter's visible property to No so you don't see the counting numbers.

Joe Miller
joe.miller@flotech.net
 
Hi NCYankee1

First draw your line in the detail section just below the text boxes. Name the line DtlLine.

Declare the following in the General Declarations of the report.

Dim intLnCount As Integer
Const MaxLnCount As Integer = 3

Add the following code to the 'On Print' event of the report.

intLnCount = intLnCount + 1

If intLnCount = MaxLnCount Then
' Make line visible
Me!DtlLine.Visible = True
intLnCount = 0
Else
Me!DtlLine.Visible = False
End If

Place the following code in the Reports 'On Open' event.

intLnCount = 0

When you preview the report, a line will be drawn after every third row.

Note: You may change the number of rows the line is drawn by change the value of the constant MaxLnCount.

-GCam
 
To clarify, the 'On Print' code should be placed in the 'On Print' event of the Detail Section.

-GCam
 
Hey thanks guys! Both ways worked. But when I did it the way GCam suggested, it looked fine in print preview. But when I printed it I got this:

detail record
--------------------
detail record
detail record
detail record
--------------------

But it works! Thanks for your help!
 
If you are trying to 'emulate' the old lineprinter paper with your report, you can accomplish this by setting the back color on the report on every thrid line. I think this is a nicer and easier to read version. Use the sane techniques, (counter mod 3), but instead of making the lline visible (or not) just set the back color to White / light grey on each trigger/toggle. Oh, and to make it really like the lineprinter paper, make the background of the controls transparent'

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
I printed the report and got the same results as NCYankee1.

The reason why this occurs is because the 'On Print' event is not triggered when the report is printed and the intLnCount variable is not reset to zero. To solve this, place the code to reset the intLnCount variable in the Report Header 'On Format' event; which is triggered when the report is previewed and then again when it is printed.

I agree with MichaelRed that toggling the back color gives the report a nice look. I did however, have concerns from some users that it does not photocopy or fax well in certain situations, which in that case it might be better to use the line.

-GCam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top