Solved

Crystal Reports storing input parameters/Calling from VB6

Posted on 2007-03-22
5
231 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

939 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now