Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting the Printer For Printing a DataWindow

2,663 views
Skip to first unread message

JZ

unread,
Jan 20, 2010, 2:17:49 PM1/20/10
to
- I have the following code where I am trying to print, but
I need to change the destination printer. I try to set it
using the Modify argument. However, when I check it right
after setting it using Describe it wants to use the default
printer on the system. I'm not sure what I am doing wrong.

Thanks in advance for your help,

JZ

DataStore lds_worksheet
lds_worksheet = Create DataStore
lds_worksheet.DataObject = 'd_worksheet'
If lds_worksheet.SetTransObject(SQLCA) <> 1 Then
Return "-1|Error Setting DataStore Transaction Object"
End If
If lds_worksheet.Retrieve(ls_BarcodeString) = -1 Then
Return "-1|Error Retrieving Data"
End If
lds_worksheet.Modify
('DataWindow.Printer="\\termserv\HP4250N" ')

ls_Printer = lds_worksheet.Describe("DataWindow.Printer")
MessageBox("Printer", ls_Printer)

lds_worksheet.Print(False, False)

Return "0|Success"

Terry Dykstra [TeamSybase]

unread,
Jan 20, 2010, 4:32:20 PM1/20/10
to
Wrong syntax. Using the DWSyntax tool (File, New, Tool) you'll find:

<DW Control Name>.Modify("DataWindow.Print.PrinterName='<string containing
the printer name for the report output>'")
<DW Control Name>.Object.DataWindow.Print.PrinterName='<string containing
the printer name for the report output>'

You can add DWSyntax to your menu by creating a custom button and using the
commandline:
wizard:?action=runonly&entry=k60_dwsyntax_sheet

--
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://casexpress.sybase.com
product enhancement requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement

<JZ> wrote in message news:4b5756dd.5f7...@sybase.com...

JZ

unread,
Jan 21, 2010, 9:23:25 AM1/21/10
to
I tried both of the following...however it still just prints
to the default printer that is setup on my PC and not to
\\termserv\HP4250N

lds_worksheet.Modify ("DataWindow.Print.PrinterName =
'\\termserv\HP4250N' ")

lds_worksheet.Object.DataWindow.Print.PrinterName =
'\\termserv\HP4250N'

Thanks In Advance For Your Help,

JZ

Terry Dykstra [TeamSybase]

unread,
Jan 22, 2010, 1:55:49 PM1/22/10
to
What happens when you open a datawindow and hardcode that name in the Print
Specifications tab?

I would also not be surprised if the \ is causing grief. What happens when
using:
ls_printer = \\termserv\HP4250N
lds_worksheet.Object.DataWindow.Print.PrinterName = ls_printer

<JZ> wrote in message news:4b58635d.7e2...@sybase.com...

0 new messages