Solved

Printer problem

Posted on 1998-12-03
5
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

617 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