Solved

Printer error 800a01e2

Posted on 2000-04-06
12
526 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
[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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
Suggested Courses
Course of the Month4 days, 5 hours left to enroll

630 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