Solved

printing to a remote printer

Posted on 2003-11-19
7
235 Views
Last Modified: 2010-05-03
i am writing an application which requires me to print to a dot matrix printer

hence to print i wrote the following code

Open "\\Node1\Epson" For Output As #1
Print #1, "Text to be printed "
Close #1


now, we have two machine node1 and node2 the printer is physially attached to node1 and the share name of the printer is Epson, when i run my application on node2 the print output is perfect with no errors

but when i try to print from node1 itself i get the following error
Run time error "52"
Bad file name or number

can some one help me with the problem

0
Comment
Question by:alifyusuf
  • 2
7 Comments
 
LVL 3

Expert Comment

by:ToolMan
ID: 9786030
Hi,
Maybe the second node can't be resolved by your operatingsystem,
you should be able to ping your nodes and see whether you can print from e.g. notepad.

regards
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9786239
I think you'll have to use the printer object.

0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 150 total points
ID: 9786450
If you do have to use the printer object, you can do it like this.

It might be worth trying, even if you don't plan to use it in the long run, because you might get a different and more informative error message.

The printers must set up on your workstation with different names, e.g. Epson1 & Epson2

Dim prn As Printer

'Find the printer by name
For Each prn In Printers
  If prn.DeviceName = ("Epson1") Then
    Exit For
  End If
Next prn

'Set the printer object
Set Printer = prn

Printer.Print "Text to be printed"
Printer.NewPage
Printer.EndDoc
0
 
LVL 28

Assisted Solution

by:vinnyd79
vinnyd79 earned 150 total points
ID: 9788530
Have you tried this on Node1:

Open "LPT1" For Output As #1
Print #1, "Text to be printed "
Close #1


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 48
passing parameter in sql procedure 9 65
vb6 connector to mongodb 2 122
Dinamic report to Crosstab query 9 35
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…

828 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