Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Business Objects: Crystal Reports 4 Other topics FAQ

Data Access

How to pass stored Procedure Parameters to the report? by emcevoy
Posted: 17 Mar 01

The following example demonstrates how to set parameters using the Crystl32.ocx from Crystal Reports version 7 with Maintenance Release 1, which is the same for version 8.

All parameters including Stored Procedure and Crystal Parameters are set with the ParameterFields property. The exception is date-time Stored Procedures that are set with the StoredProcParam property.

For Example:
In the Report Designer a report has the following three parameters that appear in the "Insert Parameter" dialog box like this:
?ShipVia (Stored Procedure string parameter)
?Date (Stored Procedure date-time parameter)
 ?OrderAmt (Crystal Report number Parameter)
The following code will pass the parameters using the OCX from a Microsoft Visual Basic (VB) application:
CrystalReport1.StoredProcParam(1) = "1998-01-01 00:00:00.000"
CrystalReport1.ParameterFields(0) = "ShipVia;UPS;True"
 CrystalReport1.ParameterFields(1) = "OrderAmt;2000;True"
- The index for the date-time Stored Procedure parameter matches the position in the list from the "Insert Parameter" dialog box beginning at zero for the first item.
- All parameters set with ParameterFields property can be in any order. The indexing is for VB to set aside memory for the parameter. In Crystal Reports the name of the parameter will be used to pass the proper value to the Crystal Report Parameter or Stored Procedure.
The following code passes in null values to a stored procedure that prompts for two parameters.
CrystalReport1.ParameterFields(0) = "crwnull"
CrystalReport1.ParameterFields(1) = "crwnull"

Back to Business Objects: Crystal Reports 4 Other topics FAQ Index
Back to Business Objects: Crystal Reports 4 Other topics Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close