Freedom1 Posted May 14, 2007 Share Posted May 14, 2007 I need more help on interfacing Crystal Reports with AutoIt. I got the viewer working fine. Now I want to pass parameters, change database & location, change output destination. It just isnt sinking in. This is a bit of VB code that Im trying to simulate in AutoIt (I picked it from one of the VB forums). Set crystal = New CRAXDRT.Application 'MANAGES REPORTS Set Report = crystal.OpenReport("C:\r104002.rpt") Report.ParameterFields(1).ClearCurrentValueAndRange Report.ParameterFields(1).AddCurrentValue (strkey1) This is my AutoIt code. Dim $sReportName Dim $CRApp Dim $CrystalReport Dim $CRViewer1 $sReportName = "C:\r104002.rpt" $CRApp = ObjCreate("CrystalRuntime.Application.10") If $CRApp = 0 Then MsgBox(0, "Error", "Could not create CrystalRuntime Object") Exit EndIf $CrystalReport = $CRApp.OpenReport($sReportName) If $CrystalReport = 0 Then MsgBox(0, "Error", "Could not open report: " & $sReportName) Exit EndIf ; FDate is a parameter in my CR. $CRApp.ParameterFields.GetItemByName("FDate").AddCurrentValue ("#05/01/2007#") I get "==> The requested action with this object has failed.: " on the previous line when I try to run it. I've also tried: $CRApp.ParameterFields(1).AddCurrentValue ("#05/01/2007#") With several variations of it with the same results. Does anyone have a clue? I sure don't. Thanks, Freedom1 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