Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Printing a file in several printers connected in WAN!

Posted on 2002-06-25
3
Medium Priority
?
131 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
[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
3 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 800 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

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

598 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