?
Solved

Crystal Reports storing input parameters/Calling from VB6

Posted on 2007-03-22
5
Medium Priority
?
236 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 101

Accepted Solution

by:
mlmcc earned 2000 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 101

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 101

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

770 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