alanbr00 Posted October 8, 2022 Share Posted October 8, 2022 I'm trying to simple run a basic report. I wanna to run automaticly and silently. I have found this script: expandcollapse popup#include <GUIConstants.au3> AutoItSetOption("WinTitleMatchMode", 2) Dim $sReportName Dim $objCRApp Dim $objCRReport Dim $objCRViewer Dim $CrystalExportOptions Dim $ExportFileName Dim $ExportType $sReportName = FileOpenDialog("C:\Test\zNC\engine\Vinhos", "", "RPT (*.rpt)", 3);Filter "." means all $objCRApp = ObjCreate("CrystalRuntime.Application.11") If $objCRApp = 0 Then MsgBox(0, "Error", "Could not create CrystalRuntime Application Object") Exit EndIf $objCRReport = $objCRApp.OpenReport($sReportName) If $objCRReport = 0 Then MsgBox(0, "Error", "Could not open report: " & $sReportName) Exit EndIf $objCRViewer = ObjCreate("CrystalReports11.ActiveXReportViewer.1") ; Create a simple GUI for our output $hndReportViewer = GUICreate ( "Embedded Crystal Reports Export test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) If $hndReportViewer = 0 Then MsgBox(0, "Error", "Could not create Window to display Crystal Reports control") Exit EndIf ;Creates an ActiveX control in the GUI. $GUIActiveX = GUICtrlCreateObj ( $objCRViewer, -1, -1, 640, 580) If $GUIActiveX = 0 Then MsgBox(0, "Error", "Could not create ActiveX Control in GUI") Exit EndIf GUICtrlSetResizing ( $GUIActiveX, $GUI_DOCKAUTO) ; Show GUI GUISetState () $objCRViewer.ReportSource = $objCRReport ; Display the Report to watch automation $objCRViewer.ViewReport ; The report displays a "0" in control 20005 while the report is loading While ControlGetText("Embedded Crystal Reports printing test", "", 20005) = "0" Sleep(250) WEnd $CrystalExportOptions = $objCRReport.ExportOptions $ExportFileName = "C:\Test\zNC\engine\Vinhos\ExportedReport.PDF" $ExportType = 31 $CrystalExportOptions.DiskFileName = $ExportFileName $CrystalExportOptions.FormatType = $ExportType $CrystalExportOptions.DestinationType = 1 $objCRReport.Export ( False ) Sleep(500) WinWaitClose("Export", "", 30) GUIDelete() I can't pass this connection error. I am using MS SQL SERVER 2008 R2 Can't find how to solve the connection issue. Link to comment Share on other sites More sharing options...
Solution AutoBert Posted October 8, 2022 Solution Share Posted October 8, 2022 read https://answers.sap.com/questions/13463181/crystal-report-error-database-vendor-code-18456-fo.html alanbr00 1 Link to comment Share on other sites More sharing options...
alanbr00 Posted October 8, 2022 Author Share Posted October 8, 2022 (edited) Hi, thanks, i already stumb with that, but could not figured out then, i try again e could it work. I created a DSN file with the "ODBC Data Source" and configured into crystal reports, i just add the DSN file as the database connection of the report. Now it work. Edited October 8, 2022 by alanbr00 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now