Solved

Printing a file in several printers connected in WAN!

Posted on 2002-06-25
3
126 Views
Last Modified: 2010-05-02
I want to print a Crystal report from VB. Actually what I want to do is that I got a few printers(say 5) connected to my server in WAN.Opening a Crystal report file in VB, I want to get the print of that file in all the printers at a time. Added info. is that I know the IP address and ports of those printers.
Please provide me any code to do this: whatever it may be!I will prefer a Macro!
Thanks for thinking about this problem.


Hi
I need to clarify a few things in your code:
Are you declaring an array arrPorts(1 to 3) of size 3
so instead of saying arrPorts(1 to 3) could i say
arrPorts(3)

I have defined all the 3 printers on the server.
so when I assign them to the array how should I do it
arrPorts(1) = "100.100.20.21:2004 LPT1:" ???
 when I try to run the program it says that p is an undefined variable.
Should I set it as a variant variable???

set Printer = defaultPrinter
This line of code has an error saying 'Type Mismatch'
And finally
when I run your code it doesnot even even go to the line
set Printer = p
Pliz help me out here.
Thanks in advance




0
Comment
Question by:mooni
3 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 7108693
i think something like this would work:

Dim defaultPrinter as Printer

set defaultPrinter = Printer

Dim arrPorts(1 to 3) as String

arrPorts(1) = "LPT1:"
arrPorts(2) = "LPT2:"
arrPorts(3) = "\\server\printer"

for each p in Printers
   for i = 1 to 3
      if p.port = arrPorts(i) then
          set Printer = p
          CrystalReport1.Destination = crptToPrinter
          CrystalReport1.PrintReport
          exit for
      end if
   next
next

set Printer = defaultPrinter

This is untested code, but basically what it does is changes your default printer to each of the specified printers at whatever ports you specify and then prints the report.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7963042
Hi mooni,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept bobbit31's comment(s) as an answer.

mooni, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8039088
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
MsgBox 2 59
How to compare ms sql hashbytes results within vb6 5 84
VB6 common control 6 sp6 object library not registerd 3 20
Dinamic report to Crosstab query 9 33
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…
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…

839 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