
Direct printouts to different printers.
Hi Gier
Quote:
>Hi,
>Anyone with ideas on how to print out Crystal reports to spesific printers
>based on data in an SQL Table. How do I get the printer information from
>ControlPanel into VB5? I want to get all the printerinformation from the
>ControlPanel, store it on SQL-Server and use it to direct printouts based
on
>criterias made by the user.
>Any ideas on ActiveX's, API's or whatever are welcome.
>thanx
>geir
You can do like this :
Dim perrtext as stiring
Dim found as boolean
Dim printrep as string
For Each x In Printers
perrtext = perrtext & x.DeviceName & Chr(13)
If UCase(Rep_prn) = UCase(x.DeviceName) Then
Set Printer = x
found = True
End If
Next x
If found = False Then
Print_Rep = "Printer could not be found on the server. Printers on
server are " & Chr(13) & perrtext
Exit Function
End If
crdevmode.dmDeviceName = Trim(Printer.DeviceName)
crdevmode.dmSpecVersion = &H320
crdevmode.dmSize = 68
result% = PESelectPrinter(jobnum%, Printer.DriverName,
Printer.DeviceName, Printer.Port, crdevmode)
Best regards
J?rgen Vendorf