Jump to content
Sign in to follow this  

Passing Parameters to Crystal Reports - How?

Recommended Posts


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).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")



$CrystalReport = $CRApp.OpenReport($sReportName)

If $CrystalReport = 0 Then

MsgBox(0, "Error", "Could not open report: " & $sReportName)



; 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.



Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this