Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer for Third Party Report in Report Writer

Status
Not open for further replies.

DWag

IS-IT--Management
Jan 28, 2003
25
US
We have a GP10 with a 3rd party integration and on one of the reports, the users would like to be prompted to select printer. Currenlty they have to change the system printer to an impact printer, print the report and remember to change it back. If user forgets to reset printer, then the next report prints on the impact printer wasting a preprinted form.

I looked at named printers but no 3rd party reports are listed.

Thanks
Dedra
 
Hi

I am the original developer of Named Printers.

You can use the Named Printers API to add your 3rd party report to Named Printers.

It is called NamePrnt.doc in the Software Development Kit (SDK) which can be installed from the Tools folder of the DVD.

You can even use VBA to add this.



David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

mailto:David dot Musgrave at microsoft dot com

Any views contained within are my personal views and not necessarily Microsoft policy.
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks for the reply. I've printed the NamePrnt.doc but am still a little confused. Where do you add "a printer task to the Printer Task Table" ?

Thanks
Dedra
 
Dedra

You can add the printer task to the table using the ST_Set_Printer_Task() function.

You can call it at any time. On Login, when the window for the report opens, whenever. It can be called multiple times ... it will only add once.

Once the task is added, you can use Named Printers to set it up.

Then use the settings when printing the report.

David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

mailto:David dot Musgrave at microsoft dot com

Any views contained within are my personal views and not necessarily Microsoft policy.
This posting is provided "AS IS" with no warranties, and confers no rights.
 
OK, I've added this to the window that the report prints from, I see this in name printers have this assigned to a printer. But when I print the report it uses my default printer .... not the named printer. Hopefully you can point me in the right direction. I'm not trained in VBA but am familiar with SQL and Progress languages.

Thanks
Dedra

Option Explicit

Private Sub Window_AfterOpen()
'Dim CompilerApp As New Dynamics.Application
Dim CompilerApp As Object
Dim CompilerMessage As String
Dim CompilerError As Integer
Dim Commands As String

' Create link without having reference marked
Set CompilerApp = CreateObject("Dynamics.Application")

' Commands to Add a Printer Task into the Named Printer Assign window
' Parameters are Series, Task ID (up to 15 chars) and Description (up to 50 chars)
Commands = ""
Commands = Commands & "ST_Set_Printer_Task(10, ""CINCH_PUR"", ""Purchase Contract Cash - Contract Printer""); " & vbCrLf
'MsgBox Commands

' Execute SanScript
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
If CompilerError <> 0 Then
MsgBox CompilerMessage
End If
End Sub
Private Sub WindowPrint_BeforeUserChanged(KeepFocus As Boolean, CancelLogic As Boolean)
'Dim CompilerApp As New Dynamics.Application
Dim CompilerApp As Object
Dim CompilerMessage As String
Dim CompilerError As Integer
Dim Commands As String

' Create link without having reference marked
Set CompilerApp = CreateObject("Dynamics.Application")

' Commands to Change the Default Application Printer based on settings in Named Printers
' Parameters are Series and Task ID (up to 15 chars)
Commands = ""
Commands = Commands & "local 'Printer Settings' NamedPrinter; " & vbCrLf
Commands = Commands & "NamedPrinter = ST_Set_To_Default_Printer(10, ""CINCH_PUR""); " & vbCrLf
Commands = Commands & "if not empty(NamedPrinter) then"
Commands = Commands & " Printer_SetDestination(NamedPrinter);"
Commands = Commands & "end if;"
'MsgBox Commands

' Execute SanScript
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
If CompilerError <> 0 Then
MsgBox CompilerMessage
End If
End Sub

Private Sub WindowPrint_AfterUserChanged()
'Dim CompilerApp As New Dynamics.Application
Dim CompilerApp As Object
Dim CompilerMessage As String
Dim CompilerError As Integer
Dim Commands As String

' Create link without having reference marked
Set CompilerApp = CreateObject("Dynamics.Application")

' Commands to restore the Default Application Printer based on settings in Named Printers
' This will restore to the System Default Printer first and then to the Company Default Printer
Commands = ""
Commands = Commands & "local 'Printer Settings' NamedPrinter; " & vbCrLf
Commands = Commands & "NamedPrinter = ST_Set_To_Default_Printer(7,ST_DEFAULT); " & vbCrLf
Commands = Commands & "if not empty(NamedPrinter) then"
Commands = Commands & " Printer_SetDestination(NamedPrinter);"
Commands = Commands & "end if;"
Commands = Commands & "NamedPrinter = ST_Set_To_Default_Printer(8,ST_DEFAULT); " & vbCrLf
Commands = Commands & "if not empty(NamedPrinter) then"
Commands = Commands & " Printer_SetDestination(NamedPrinter);"
Commands = Commands & "end if;"
'MsgBox Commands

' Execute SanScript
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
If CompilerError <> 0 Then
MsgBox CompilerMessage
End If
End Sub
 
I would say that you have a timing issue.

You are setting the printer back to the default printer before the report prints.

If the print button opens any dialogs then the after script you have will run before the report gets printed.

Try changing the after code to run when you close the window.

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top