Solved

Crystal Reports storing input parameters/Calling from VB6

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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 While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

821 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