Solved

Printer problem

Posted on 1998-12-03
5
248 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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