Solved

Printer problem

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

862 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

24 Experts available now in Live!

Get 1:1 Help Now