?
Solved

Open report file in reportviewer with any recordset ?

Posted on 2003-03-18
14
Medium Priority
?
302 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
[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
  • 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
Industry Leaders: 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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
Course of the Month14 days, 9 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