Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Open report file in reportviewer with any recordset ?

Posted on 2003-03-18
14
Medium Priority
?
306 Views
Last Modified: 2010-04-07
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
0
Comment
Question by:shurid
  • 7
  • 4
  • 2
  • +1
14 Comments
 
LVL 1

Author Comment

by:shurid
ID: 8169819
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
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8170454
Just before this line
CRViewer91.ViewReport

add

rptReport.DiscardSavedData

mlmcc
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:shurid
ID: 8235167
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?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8235464
Can you open the report in CR

Click FILE
Ensure SAVE DATA WITH REPORT is not checked

mlmcc
0
 

Expert Comment

by:CleanupPing
ID: 8532062
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.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8537581
shurid - Do you still need help?

mlmcc
0
 
LVL 1

Author Comment

by:shurid
ID: 8629350
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.
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 300 total points
ID: 8635141
Try this before building a new report

Open the report in CR
Click FILE
Ensure SAVE DATA WITH REPORT is not checked
Save the report


Before the line the view the report add this

rptReport.DiscardSavedData

Another thought (This is how I filter data for a report)
Put this before viewing the report

rptReport.RecordSelectinFormula = "BookNo = 10"

mlmcc

0
 

Expert Comment

by:CleanupPing
ID: 8899979
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?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8906568
Have you tried any of my last suggestions?

mlmcc
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 8957259
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
0
 
LVL 1

Author Comment

by:shurid
ID: 9625142
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
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9630857
The ADO methods didn't work?  Do you still need help with this or have you moved on to other projects?

mlmcc
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

572 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