View Full Version : Print View of Report in Accde - Not Working


PWrigh99
12-17-2009, 08:11 AM
I have created an application in MS Access 2007 and then created an accde file. Everything works in the accde except for a report to print an invoice.

The print preview is done from a button on an invoice form, the code in the form is:

Private Sub cmdInvoice_Click()
On Error Resume Next
Dim strWhere As String
strWhere = "Invoices.Invoice_No= '" & Me.Invoice_No & "'"
DoCmd.OpenReport "Invoices", acViewPreview, , strWhere
End Sub

I have another report that I run from this form as well and it works without a hitch. The code is almost identical except of course for the report name.

The invoice report file does contain a subreport and I do use code to put a box on the report. The code for the box that is in the report is:

Private Sub Report_Page()
On Error Resume Next
' Set Thickness and Border Style
Me.DrawWidth = 6 ' larger number, thicker line
Me.DrawStyle = 0 ' 0 to 6 = solid to invisible

' Set line to print X inches from the left margin.
x1 = 0
x2 = Me.ScaleWidth
' Set line to print from the top of the detail section
' to a maximum height of Y inches.
y1 = 3200
y2 = Me.ScaleHeight / 1.15
' object.Line (x1, y1) - (x2,y2), color, [Box=B]
Me.Line (x1, y1)-(x2, y2), vbBlack, B
End Sub

I did take this code out and tried to run but no luck. I did not try it without the subreport but that is a vital part of the overall report. I click the button and nothing happens.

This all runs fine in the accdb file.

Help!

Thanks in advance.

PWrigh99
12-17-2009, 09:57 AM
Okay...got this answered offline. It was a compile issue.

Thanks!!