Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printer error 800a01e2

Posted on 2000-04-06
12
Medium Priority
?
532 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
Technology Partners: 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 800 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses

704 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