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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Printing What Print Preview Displays

Status
Not open for further replies.

abbeyru

Technical User
Feb 21, 2003
4
US
The issue is indenting a text box to look like this when it prints
Print Preview
COMPANY NAME INFO1 INFO2
MyCompany | |
Other Company | |
Other Company | |
Other Company | |

Actual Printed Copy
COMPANY NAME INFO1 INFO2
MyCompany | |
Other Company | |
Other Company | |
Other Company | |

I wrote code that formats the report to look like this by moving the 2nd 3rd and 4th text boxes over using if statement and it looks fine in print preview. However, when I print, the "My Company" is shifted over aligned with all the "Other Company"'s so the indent effect is gone. I'm assuming I have to write some code during the on print action but haven't figured it out yet.
 
One more thing...
It prints correctly when I click on the report Icon and print. However, when I open the report up in print preview, then print, i run into the error.
 
I would use vertical lines:

Put this code in the detail of each section of the report - OnPrint command, 567 units is 1cm:



Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Me.ScaleMode = 1
Me.ForeColor = 0
' Repeat the following line of code for each vertical line
' 1 * 1440 represents 1 inch.
Me.Line (0 * 567, 0)-(0 * 567, 14400)
Me.Line (1 * 567, 0)-(1 * 567, 14400)
Me.Line (2 * 567, 0)-(2 * 567, 14400)
Me.Line (5.5 * 567, 0)-(5.5 * 567, 14400)

' The 14400 is an arbitrary number to increase the line
' to the max of a section.

End Sub

Put this bit below in the OnPage trigger of the report:


Private Sub Report_Page()

If Me.Page <> 1 Then

Me.ScaleMode = 1
Me.ForeColor = 0
' Repeat the following line of code for each vertical line.
' 1 * 1440 represents 1 inch.
' Draws line at Left Margin.
Me.Line (0 * 1440, 0)-(0 * 1440, 14400)
' Draws line at 1 inch.
Me.Line (1 * 1440, 0)-(1 * 1440, 14400)
' Draws line at 2 in.
Me.Line (1.9 * 1440, 0)-(1.9 * 1440, 14400)
' Draws line at 3 in.
Me.Line (5.5 * 1440, 0)-(5.5 * 1440, 14400)

End If

' The 14400 is an arbitrary number to increase the line to the max
' of a section.

End Sub



You will probably have to alter it to suit your requirements, but the results are worth the effort.

Garry
 
Thanks Garry,
Just What I needed!! With a little tweaking, works great.
Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top