PRB: Compilation error when adding the VBA code to a report in Microsoft Dynamics GP
Print
ZTN4187
ID: ZTN4187
This Zetadocs for GP technical note applies to:
- Version 2.5 of Zetadocs for GP
Symptom
If the user follows section Appendix D – Example VBA code for Zetadocs enabled Report of the Zetadocs for Microsoft Dynamics GP Standard Configuration Guide a compilation error occurs.
Cause
This problem is due to the change of the functions that enable the Reports of the Zetadocs for Microsoft Dynamics GP. These changes were omitted from the Standard Configuration Guide.
Resolution
The changes required are detailed below. The problem area in the example is shown below and the correct code is displayed in red below it.
Dim ZetadocsGPLibrary As Zetadocs_GP_Library.ReportProcessor
Private Sub Report_BeforePH(SuppressBand As Boolean)
ZetadocsGPLibrary.StartPage documentIDInput:=PONumber, reportDocType:=" Purchase Order"
End Sub
Private Sub Report_BeforeRH(SuppressBand As Boolean)
ZetadocsGPLibrary.StartPage documentIDInput:=PONumber, reportDocType:=" Purchase Order"
End Sub
Private Sub Report_End()
ZetadocsGPLibrary.EndReport
Set ZetadocsGPLibrary = Nothing
End Sub
Private Sub Report_Start()
Set ZetadocsGPLibrary = New Zetadocs_GP_Library.ReportProcessor
ZetadocsGPLibrary.StartReport reportID:=" POPHistoryPurchaseOrderBlankFo" , documentGPTable:=" POP30100" , contactTable:=" PM00200"
Do While ZetadocsGPLibrary.IsPrintQueueEmpty = False
DoEvents
DoEvents
DoEvents
DoEvents
Loop
ZetadocsGPLibrary.ChangePrintFileName
End Sub
Dim ZetadocsGPLibrary As Object
Dim ReferenceAvailable As Boolean
Private Sub Report_BeforePH(SuppressBand As Boolean)
If ReferenceAvailable = True Then
ZetadocsGPLibrary.StartPage documentIDInput:=PONumber, reportDocType:=" Purchase Order"
End If
End Sub
Private Sub Report_BeforeRH(SuppressBand As Boolean)
If ReferenceAvailable = True Then
ZetadocsGPLibrary.StartPage documentIDInput:=PONumber, reportDocType:=" Purchase Order"
End If
End Sub
Private Sub Report_End()
If ReferenceAvailable = True Then
ZetadocsGPLibrary.EndReport
Set ZetadocsGPLibrary = Nothing
End If
End Sub
Private Sub Report_Start()
On Error Resume Next
Set ZetadocsGPLibrary = CreateObject(\" Zetadocs.GP.Library.ReportProcessor\" )
If Err.Number < > 0 Then
ReferenceAvailable = False
Set ZetadocsGPLibrary = Nothing
Else
ReferenceAvailable = True
End If
Err.Clear
On Error GoTo 0 'this disables the OnErrorResumeNext error trapping from the beginning
If ReferenceAvailable = True Then
ZetadocsGPLibrary.StartReport reportID:=" POPHistoryPurchaseOrderBlankFo" , documentGPTable:=" POP30100" , contactTable:=" PM00200"
Do While ZetadocsGPLibrary.IsPrintQueueEmpty = False
DoEvents
DoEvents
DoEvents
DoEvents
Loop
ZetadocsGPLibrary.ChangePrintFileName
End If
End Sub
Status
This has been identified by Equisys as an issue with the software versions given above.
Last updated: 26th March 2012 (AT/MW)
Keywords: Zetadocs for GP Compilation Error when enabling reports