Solved

Printer problem

Posted on 1998-12-03
5
246 Views
Last Modified: 2010-05-03
I have a common dialogue box show up for the printing and when I print it goes there and I click ok then it says  "Run-time error '482'  Printer error"
Any ideas on why this is happening?

Ok, here's my code.  When I run it the printer box appears. Then I click ok to start the printing.  An error message appears saying "printer error". If I take out the 4 lines below with the asteriks and test the printer communication it works. Help!

Private Sub mnuFilePrintReport_Click()
Dim PageNumber As Integer
Dim LineCounter As Integer
Dim RecordCounter As Long

'print the report.
***cdPrint.Copies = 2
***cdPrint.filename = Trim(App.Path) & "/MyReport.txt"
***cdPrint.ShowPrinter
***Debug.Print cdPrint.Copies
 
'print something
  Printer.Orientation = 1
  PageNumber = 0
  LineCounter = 999
  datData.Refresh
  datData.Recordset.MoveFirst
  RecordCounter = 0
  Do While datData.Recordset.EOF = False
    RecordCounter = RecordCounter + 1
    If LineCounter >= 15 Then
      PageNumber = PageNumber + 1
      LineCounter = 0
      If PageNumber > 1 Then
        Printer.NewPage
      End If
      Printer.Print
      Printer.Print
      Printer.Font.Bold = False
      Printer.Font.Size = 9
      Printer.Font.Name = "Times New Roman"
      Printer.Print Tab(10); "Date"; Format(Now, "mm dd, yyyy")
      Printer.Font.Bold = True
      Printer.Font.Size = 12
      Printer.Font.Italic = True
      Printer.Font.Name = "Arial"
      Printer.Print Tab(40); "List of Divisions";
      Printer.Font.Bold = False
      Printer.Font.Italic = False
      Printer.Print Tab(100); "Page: "; PageNumber
      Printer.Print Tab(10); "Division"; _
        Tab(25); "Date"; _
        Tab(40); "Division"; _
        Tab(60); "Division"
      Printer.Print Tab(10); "ID"; _
        Tab(25); "Approved"; _
        Tab(40); "Manager"; _
        Tab(60); "Name"; _
        Tab(90); "Remarks"
      Printer.Print Tab(40); "Name"
      Printer.Print Tab(10); "--------------------------------------"; _
        "-----------------------------------------------------------"; _
        "-------------------------"
      Printer.Print
    End If
'Go back to the start of the record set
    Printer.Print Tab(10); Trim(datData.Recordset.Fields("Divisionid")); _
        Tab(25); Trim(datData.Recordset.Fields("Date")); _
        Tab(40); Trim(datData.Recordset.Fields("DivisionManagerName")); _
        Tab(60); Trim(datData.Recordset.Fields("DivisionName")); _
        Tab(90); Left(datData.Recordset.Fields("Remarks"), 40)
    LineCounter = LineCounter + 1
    If Len(datData.Recordset.Fields("remarks")) > 40 Then
        Printer.Print Tab(60); _
        Mid(datData.Recordset.Fields("remarks"), 41, 40)
        LineCounter = LineCounter + 1
    End If
    datData.Recordset.MoveNext
  Loop
  Printer.Print
  Printer.Print Tab(10); "Number of records: "; Format(RecordCounter, "#,##0")
  Printer.EndDoc
  datData.Recordset.MoveFirst
  txtDivisionID.SetFocus
  Exit Sub
 
End Sub
0
Comment
Question by:cbananaj
  • 3
5 Comments
 
LVL 2

Expert Comment

by:trillo
ID: 1448078
Could you send some code?... I think we need a little more information to help, otherwise any of us could say "... I tried it and worked fine..."

Trillo
0
 

Author Comment

by:cbananaj
ID: 1448079
Edited text of question
0
 

Author Comment

by:cbananaj
ID: 1448080
Edited text of question
0
 

Accepted Solution

by:
JimmieToo earned 100 total points
ID: 1448081
Shouldn't it be

.... & "\MyReport.txt"

JIm

0
 

Author Comment

by:cbananaj
ID: 1448082
Well that might have been one thing but when I push print report on my menu it goes normal. It comes to the Dialogue box for the printer to choose how many copies, default printer... and when I push ok it says Printer Error and highlights the Printer.Orientation = 1 when I push debug.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question