Link to home
Start Free TrialLog in
Avatar of shurid
shurid

asked on

Open report file in reportviewer with any recordset ?

hello sir,

what i have to do is open an Crystal report 9's (rpt File) into ReportViewer in VB with an already open recordset/dataenv. what i did is something like this:
-----
Dim CrystalApp As New CRAXDRT.Application
Dim rptReport As New CRAXDRT.report
Set rptReport = CrystalApp.OpenReport("c:\book\rptBookAll.rpt")
rptReport.Database.SetDataSource DataEnv.rsBook
CRViewer91.ReportSource = rptReport
CRViewer91.ViewReport
-------
its opening but not with "DataEnv.rsBook" recordset.

What i wanna do is open a report with a recordset. sometimes with "dataenv.rsBookAll" & sometimes with
"dataenv.rsBookFiltered".

I dont want to use any formula in rpt. just what eva the recordset with contain that report needs to show.

............Please help meeee pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Avatar of Mike McCracken
Mike McCracken

Avatar of shurid

ASKER

the dataenv/recordset i am giving Crystal report is displaying those records alright. but if i use filtered rs then its not displaying the filtered records...still its displaying all records.. i can use recordselection formula in CR report but i dont wanna do that..

i want to print exactually what i am viewing in form using dataenv. if the record is filtered then filtered & if its sorted then sorted.....can u help me to do that plsssss
Just before this line
CRViewer91.ViewReport

add

rptReport.DiscardSavedData

mlmcc
Avatar of shurid

ASKER

its not taking filtered recordset. if i filter the record cr9 display the whole records with in that recordset which is not visible cos of filter in recordset... what i ment is that cr9 is taking that RS but not including the filter by Discard filter. why? how to make it take filtered rs?
Can you open the report in CR

Click FILE
Ensure SAVE DATA WITH REPORT is not checked

mlmcc
Hi shurid,
This old question (QID 20555013) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
shurid - Do you still need help?

mlmcc
Avatar of shurid

ASKER

yes i still need help, cos i could able to view filtered record in crystal report with filter command. cos crystal report is showing all the record in that query.

pls do this for me,

1. create a report "book.rpt" file from a table or view. (Before u run).
2. Open a new VB6 project.
3. create a recordset.
3. use SQL command in that recordset. (Select * from Book)
3. Filter that recordset with filter command. (rs.Filter = "BookNo = 10")
3. Now preview this recordset in that book.rpt file.
3. Can u see only 1 record with bookno 10,

I couldn't i am seeing all the record from book table. but if u use condtion while opening recordset like "Select * from Book where BookNo = 10" then it is working & i am seeing only 1 record.

So my Question is Why SQL Condtion is working but not Filter ????? pls try it cos i need this help, but no 1 did help me except u.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
shurid:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
Have you tried any of my last suggestions?

mlmcc
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->Accept mlmcc's comments as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
Avatar of shurid

ASKER

none of this worked any way cos i didnt want to use formula from CR i wanted to Filter my VB recordset from vb then open that filtered recordset into CR. but no 1 could help. me or i couldnt able to make people understand what i want. but i will give the points to mlmcc cos he try to help me. thankx mlmcc u r great. thankx for trying
The ADO methods didn't work?  Do you still need help with this or have you moved on to other projects?

mlmcc