Solved

Crystal Reports storing input parameters/Calling from VB6

Posted on 2007-03-22
5
234 Views
Last Modified: 2013-12-25
I have a Crystal Reports 8 report whose SQL command is:

{call db.dbo.GetHistoricalApprovalRecords;1(?,?)}

GetHistoricalApprovalRecords is a stored procedure that takes two DateTime parameters, the period's start date and the period's end date.

The report itself works great.  If I hit refresh, it gives me the option to prompt for new values or use the current values.  That's not a problem.

However, when I call this report from Visual Basic 6, it uses the current values in the two DateTime input parameters (specifically, it uses the last two values I explicitly put in and saved the report).  I imagine Crystal stores those values in the report itself.    

My question is if it is possible to stop this behavior.  I would like to be prompted every time the report is opened, refreshed, etd.  I do not want to store any values in the report itself.

Notes:
The two input parameters are from the stored procedure that I added to the report.  

The code from VB6 is:
Set app1 = CreateObject("Crystal.CRPE.Application")
Set rpt2 = app1.OpenReport("\\reportShares\ApprovalRecords.rpt")
rpt2.Database.Tables(1).SetLogOnInfo sqlserver, db, uid, pwd

rpt2.Preview

If possible, I do not want to pass the input values from VB6 to the report.  I would like to open the report from VB6 and ahve it automatically prompt me for the values.  

Thanks in advance!  
0
Comment
Question by:LA_Code_Poet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 18774475
Make sure the report isn't saved with data
Open the report in Crysta;
Click FILE
Unckeck SAVE DATA WITH REPORT

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18774491
Another option
Open the report in Crystal
CLick FILE --> OPTIONS
Click the DATABASE tab
Click REPROMPT WHEN OPENING

mlmcc
0
 
LVL 11

Expert Comment

by:TreyH
ID: 18787511
See if the report object has a 'DiscardSavedData'

Set app1 = CreateObject("Crystal.CRPE.Application")
Set rpt2 = app1.OpenReport("\\reportShares\ApprovalRecords.rpt")

rpt2.DiscardSavedData '<--- Try adding this line.

rpt2.Database.Tables(1).SetLogOnInfo sqlserver, db, uid, pwd
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 18792681
You can also clear the previous parameter values, which should cause Crystal to prompt you.  Do:

rpt2.ParameterFields.Item(1).ClearCurrentValueAndRange

repeat as need for multiple parameters.

0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18838128
Glad i could help

mlmc
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question