Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing selection criteria witout accessing database

Status
Not open for further replies.

ishaan99

Programmer
Aug 5, 2002
2
US
Hi All
This is my first post here and am new to crystal reports. The following is what I would like to achieve.
I have a .rpt file “saved with data”. I need to get a new set of records based on the saved data in the file, without the .rpt file having to access the database, when I change the selection criteria. This is possible within Crystal report environment. The reason for this is, selecting data out of a saved report is considerably quicker than accessing the database to retrieve data.

How can I programmatically achieve the same with VB 6?

This is my code;
Code:
Dim Crystalapp As New CRAXDRT.Application
Dim Crystalrep As CRAXDRT.Report
Dim callNo As String

Set Crystalrep = Crystalapp.OpenReport("C:\HEATSelectionTest.rpt")

callNo = InputBox("Please enter your selection")

Crystalrep.RecordSelectionFormula = "{CallLog.CallID} = '" & callNo & "'"
CRViewer1.ReportSource = Crystalrep
CRViewer1.ViewReport
CRViewer1.Zoom (100)
If I insert the flowing line of code
Code:
Crystalrep.Database.Tables(1).SetLogOnInfo "ODBC", "Database", "UserID", "Pwd"

The program works, however after accessing the database, which takes a long time when all I want is some records out of the saved report
Without the above a line a blank report is displayed, with the message that the server has not yet been opened.
I am using Crystal Report 8 with VB 6.
Any help with this will be appreciated.
Thanking all of you in advance

Ishaan
 
I can think of two options:
1) Integrate the report into a VB application. Use an ADO recordset to hold the data. Then you'll be refreshing the report against the recordset rather than querying the database all over again.
2) Use a Crystal Query with saved data for the report.
Andrew Baines
Chase International
 
Andrew,
Thanks you very much.
Will try what you suggest on Monday. Meanwhile have a great weekend.

regards
Ishaan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top