Solved

Printer problem

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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.
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…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now