Report Data not being sent to printer

T

tech.rawsteak

Hey all,

I have created a report that mimics an order form. to fit a normal
sized paper, blank rows are added to the report so that it looks like
an actual order form, instead of an order form with only 3 entries.
it looks great when its printed onto the screen, but it does not print
physically to the printer or even to pdf. any ideas to what could be
going wrong?
 
D

Duane Hookom

Do you have any code you could share with us? What makes your preview display
extra lines? Are we supposed to know your method without you providing some
details?
 
T

tech.rawsteak

Option Compare Database

Option Explicit
Dim intLineNumber As Integer
Dim fShowLine As Boolean
Dim msg As Variant

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo Err_Detail_OnFormat

Dim intTotalItems As Integer
Const conTotalLines = 16 ' Total number of lines Desired

intTotalItems = DCount("[itemID]", "reqItems Table", "[itemReqNumber]
= " & Me.poPRID)

If intLineNumber <= intTotalItems Then
With Me
.itemName.Properties("ForeColor") = 0
.itemAmtPerUnit.Properties("ForeColor") = 0
.itemUnitQty.Properties("ForeColor") = 0
.itemUnitCost.Properties("ForeColor") = 0
.itemTotalCost.Properties("ForeColor") = 0
.MoveLayout = True
If intLineNumber <> intTotalItems Then
.NextRecord = True
Else
.NextRecord = False
End If
.PrintSection = True
End With
intLineNumber = intLineNumber + 1

ElseIf intLineNumber <= conTotalLines Then
With Me
.itemName.Properties("ForeColor") = 16777215
.itemAmtPerUnit.Properties("ForeColor") = 16777215
.itemUnitQty.Properties("ForeColor") = 16777215
.itemUnitCost.Properties("ForeColor") = 16777215
.itemTotalCost.Properties("ForeColor") = 16777215
.MoveLayout = True
.NextRecord = False
.PrintSection = True
End With
intLineNumber = intLineNumber + 1
End If

Exit_Err_Detail_OnFormat:
Exit Sub

Err_Detail_OnFormat:
MsgBox Err.Description
Resume Exit_Err_Detail_OnFormat

End Sub

Private Sub Report_Open(Cancel As Integer)

' Initialize variables
fShowLine = True
intLineNumber = 1

End Sub



when the report is printed out, a single blank order line is
displayed, and none of the order lines that were retrieved are shown
 
D

Duane Hookom

You should set some debug.print code to show you what the values are. You
might need to reset the line count in the On Format event of the report
header section.

I suggest using code in the On Page event to draw all the lines like:
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
For intLineNumber = 0 To intNumLines - 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