Solved

Printer error 800a01e2

Posted on 2000-04-06
12
518 Views
Last Modified: 2008-03-17
I wrote a Dll in vb 6 which does nothing but print to a printer the variables it is passed.

This dll works fine on my system but when it is moved to the server it gets a printer error 800a01e2 when ever it comes across the statement printer.print.



This is my code in the dll, I left out all of the properties for space on this message.
(keep in mind this dll runs fine when called from my system.  To debug it i commented everything out except the first printer.print statement, that is where it is failing.


Public Sub Print_Certificate()
Dim CurrentNum As Long
Dim x As Printer
   
    For Each x In Printers
        Set Printer = x
        If Printer.DeviceName = myPrinter Then
            Set Printer = x
            Exit For
        End If
    Next x
   
    Printer.FillStyle = 2
'    Printer.FillColor = RGB(0, 0, 255)
'
'    CurrentNum = 0
'    Printer.FontSize = 10
'    Printer.Font = "Verdana"
'
        'Skip down 11 lines for the first gift certificate
'        For I = 1 To 11
'            Printer.Print " "
'        Next I
'
'        If MYGID1 = "" Then GoTo Finish
'
'        'Use tab location 36
'        Printer.FontSize = 10
'        Printer.Print Tab(37); "For: "; myLinefor; Tab(71); "From: "; myLinefrom
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(36); myLineAmount; Tab(71); myLineExpires
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(37); MYGID1 'provided by asp call for the number
'        Printer.FontSize = 8
'        Printer.Print " "
'        Printer.Print Tab(47); myLine4 'Detail line 1
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(49); myLine5 'Detail line 2
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(52); myLine6 'Detail line 3
'
'
'        If MYGID2 = "" Then GoTo Finish
'
'        For I = 1 To 11
'            Printer.Print " "
'        Next I
'
'        'Use tab location 36
'        Printer.FontSize = 10
'        Printer.Print Tab(37); "For: "; myLinefor; Tab(71); "From: "; myLinefrom
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(36); myLineAmount; Tab(71); myLineExpires
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(37); MYGID2 'provided by asp call for the number
'        Printer.FontSize = 8
'        Printer.Print " "
'        Printer.Print Tab(47); myLine4 'Detail line 1
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(49); myLine5 'Detail line 2
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(52); myLine6 'Detail line 3
'
'        If MYGID3 = "" Then GoTo Finish
'
'        For I = 1 To 11
'            Printer.Print " "
'        Next I
'
'        'Use tab location 36
'        Printer.FontSize = 10
'        Printer.Print Tab(37); "For: "; myLinefor; Tab(71); "From: "; myLinefrom
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(36); myLineAmount; Tab(71); myLineExpires
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(37); MYGID3 'provided by asp call for the number
'        Printer.FontSize = 8
'        Printer.Print " "
'        Printer.Print Tab(47); myLine4 'Detail line 1
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(49); myLine5 'Detail line 2
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(52); myLine6 'Detail line 3
'
'
'Finish:
'    Printer.EndDoc
'
End Sub


Any suggestions as to why this would return a printer error 800a01e2 when it tries to do printer.print??
0
Comment
Question by:jtjcomp
  • 6
  • 2
  • 2
  • +2
12 Comments
 
LVL 1

Expert Comment

by:cchenoweth
ID: 2689761
Ok..  stupid question for you.  Does the server see that shared printer (can you print from other programs?)  Is the MyPrinter Var set right?

0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2689973
Yes i can print to it
0
 
LVL 1

Expert Comment

by:cchenoweth
ID: 2689991
what is the Myprinter Var set to?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 1

Expert Comment

by:ATM
ID: 2690017
Have You try to use printer from ASP?
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690235
Here is an update:

I made a vb app that uses that dll and installed it on the server. It worked. the dll printed.  

Then i tried to call the dll from my asp page, it failed.

so what am i missing that allows it to work if vb calls it and does not allow it to work if asp calls it.

When i call with asp the object is created fine and the functionality is passed to the dll.  I know this because i commented all the printer.print statements out and the asp page worked fine.  This means that the dll opened executed the select printer code then closed.

0
 
LVL 2

Expert Comment

by:damienm
ID: 2690300
You should not set printer = x until the printer has found x.  If it does not find x it will then print to the default printer (as opposed to giving an error message).

Try using this code instead

Public Sub Print_Certificate()
Dim CurrentNum As Long
Dim x As Printer
     
For Each x In Printers
    If UCase(x.DeviceName) = myPrinter Then
        Set Printer = x
    End If
Next x

Printer.print "Test"

End Sub

0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690437
Yes i switched it but that code was already working, (it was the code that was not commented out.)

anyway same deal even when swithed.
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690455
Heck if it would print to the default printer that would be better then what it is doing now...
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 200 total points
ID: 2690485
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690486
Heck if it would print to the default printer that would be better then what it is doing now...
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690550
The article was perfect.
thanks
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2690564
Anytime  =)
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

773 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