RecordSelectionFormula for both crystal report and sub report...

 Hello,


I am developing using VB.NET and I have a major problem with my crystal report. When I want to attempt to display information on the crystal report with a condition that UserID = <Value> and ReportID = <Value> using RecordSelectionFormula for both the main report and it's subreport I get the following problem:

Main report displays ALL values and sub report displays the correct value, or sometimes it is the other way around depending on how I adjust the code but it is neither both.  How can I fix this problem?

Below is the code:

  

1     Public Sub BindReportDetailsData(ByVal UserID As String, ByVal ReportID As Long, ByVal _Path As String, ByVal _ReportViewer As CrystalDecisions.Web.CrystalReportViewer)
2            Dim _Report As New ReportDocument
3            Dim _MySubReport As New ReportDocument
4            Dim _MyReport As ReportObject = Nothing
5            Dim _SubReportObject As SubreportObject = Nothing
6    
7    
8    
9            _Report.Load(_Path)
10           _Report.SetDatabaseLogon("foody", "amiga1200")
11   
12           For Each _MyReport In _Report.ReportDefinition.ReportObjects
13               If _MyReport.Kind = CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then
14                   _Report.DataDefinition.RecordSelectionFormula = "{ExpenseUsers.UserID}= ""{" & UserID & "} AND {ExpenseItems.ReportID} = " & ReportID & ""
15                   _SubReportObject = CType(_MyReport, CrystalDecisions.CrystalReports.Engine.SubreportObject)
16                   _MySubReport = _SubReportObject.OpenSubreport(_SubReportObject.SubreportName)
17                   _MySubReport.DataDefinition.RecordSelectionFormula = "{ExpenseUsers.UserID}= ""{" & UserID & "} AND {ExpenseItems.ReportID} = " & ReportID & ""
18                   _ReportViewer.DisplayToolbar = True
19                   _ReportViewer.HasRefreshButton = False
20                   _ReportViewer.HasSearchButton = False
21                   _ReportViewer.HasToggleGroupTreeButton = False
22                   _ReportViewer.HasViewList = False
23                   _ReportViewer.HasZoomFactorList = False
24                   _ReportViewer.HasPageNavigationButtons = False
25                   _ReportViewer.HasGotoPageButton = False
26                   _ReportViewer.HasDrillUpButton = False
27                   _ReportViewer.HasCrystalLogo = False
28                   _ReportViewer.HasPrintButton = True
29                   _ReportViewer.ReportSource = _Report
30               End If
31           Next
32   
33           '_Report.Subreports.Item(0).DataDefinition.RecordSelectionFormula = "{ExpenseItems.ReportID}=" & _ReportID & ""
34          
35   
36           _ReportViewer.DataBind()
37       End Sub
Can someone help me please? Thanks in advance.
0
foody
11/5/2007 7:04:43 PM
asp.net.crystal-reports 7043 articles. 0 followers. Follow

3 Replies
1896 Views

Similar Articles

[PageSpeed] 53

Please can someone help me? My post is going down and no one helped me yet.  

0
foody
11/7/2007 1:44:34 PM

Please can someone help me thanks in advance? 

0
foody
11/9/2007 4:43:01 PM

Can someone please stop ignoring me!? Angry 

 

Can anyone help me in this regard? Thanks in advance. 

0
foody
11/12/2007 3:10:27 PM
Reply:

Similar Artilces:

Converting Crystal Reports 9 report to Crystal Reports .NET report
I have a web page that is supposed to display a crystal report.  The report is fully written and functional in crystal 9 (non-.Net)  .  Is there a way to convert my .rpt so that I can just include it in the new web site? why you don't try to compile project with .net and include your report. then if crystal report is power tool will suggests you with conversation tool    My blog is here.Please remember to 'Mark as Answer' if this post answered your question! Wow it really was that easy!  I just added the old crystal report into my .NET proj...

crystal reports .net -> crystal reports .net 2003
recently converted a project from .net to .net 2003. The 2 crystal reports I had in the project do not load when executing the application. The project itself within 2003 will allow me to multiplat the crystal reports, however when it comes to execution time I get the error: Invalid Data Source. If this isn't the right forum please point me to the right one as this is really the only website I know of with a large reader base. >to multiplat the crystal reports To what the crystal reports? Do you have the same database connections established and verified in your 2003 s...

Crystal Report.NET and nested sub reports
I have a report where i need to have several nested subreports... A parent may have childs and childs may have other childs and so on... CrystalReport.NET and VS2005 seems to support one level of subreport (a report could have a nested subreport but this nested subreport can't have another nested subreport). I really need to handle multiple levels of nested subreports in order to complete my report. What is the solution ???   Thanks   Eviral     I'm not positive if this works but its worth a shot.  Create the subreports as se...

integration of Crystal Report with .NET ; crystal report viewer not displaying in Toolbox
Hi I m new to Visual Web Developer 2005 Express Edition. I want to integrate Crystal Report with .NET. In my Toolbox , Crystal Report Viewer is not displaying. How to make it possible? + How to call my report from asp.net 2.0. Need source code plz.*Share Knowledge Every TIME Crystal Reports for .NET does not come with VWD Express.  It only comes with VS 2005 Professional (I'm not sure about the Standard edition).If you have Crystal Reports 10 or XI, you can installed the .NET libraries for Crystal and then use them within VWD Express, noting that you have to build your reports ...

Are there other reporting tools other than reporting services and crystal reports
Has anyone had any experience with any reporting tools other than Reporting services and Crystal reports? If so, is there one that you would strongly recommend? Or, are these two the top choice on the market for report generation from .NET? I have heard some moaning and groaning about reporting services. Specifically in regards to the amount of time needed to design a report. Crystal reports seems kind of difficult to me, as I don't have any training with it. Basically I am looking for a reporting tool that is easy to use, and can be used from .NET....

VS .net 2005 Crystal reports ok to run on Crystal Reports XI?
I am getting mixed messages from the asp.net website hosting providers - some say they do not support Crystal Reports due to a $25,000 per cpu licensing fee, others say all I need to do is install Crystal Reports XI (about $500) on a dedicated server and it will run fine. Will Reports developed with the embeded Crystal Reports in VS 2005 run in a Crystal Reports XI environment? Thanks....

Cassini, VS.Net and Crystal Reports
Hi,I am working with Win XP home, Cassini and VS.Net.I would like to play with some Crystal Reports.I create the report in VS as CrystalReport1.I put a CrystalReportViewer on my web form. It does not get recognized as a defined object type but there are no build errors.When I run the app I get an error: Type 'CrystalReport1' is not defined.I have googled on this and see several things people have suggested/tried to correct this. Most I have already tried or the suggestions are not very clear to me. Then I came across a msg that instructed me to set up virtual directories for IIS for CrystalR...

Export Crystal Report to Crystal Report format
I looked at some sample code provided by crystaldecisions, and they have the ability to export a web crystal report to a crystal report. I was assuming that this would cause the local instance of Crystal reports on the client machine to be invoked. I tried this in my project, and I get the following error: Error Encountered by Crystal Web Report Server -------------------------------------------------------------------------------- The error message returned is: Connection to Report Server Failed. It creates the file as an .rpt file in the directory it should. Do I need a dif...

crystal report sub report problem
my subreport is on report footer still some how it leaves blank on each page. if you can please help Thanks...

Crystal Reports Sub Report not showing data
Hi,   I have a Crystal Report which has two sub reports in it. When I try to view this Crystal Report in my local computer, it is showing data for sub reports also. But when I deploy it to the web server and view the Crystal Report I am not able to view the data of sub reports. It is not giving any error. It is not showing the data. I checked the dlls of Crystal Report. Both the local host and server has same versions. I am not knowing what might be the problem. Please let me know if you have any idea. Thanks I guess that if you are getting data on the report but not on subreports may be it is because you need to change the sub-reports table location (and logon) programatically (if you are under the pull model), more info on that at this URL: http://aspalliance.com/231 I Hope this helps! Hi,       Thanks for the reply. I have used the method that is specified in the URL and it is working fine. But the thing is I don't want to add the user name and password in the code. Is it possible to specify windows Authentication instead of hardcoding username and password? Thanks, Sridhar. You donĀ“t have to hard code it, you could read username and password from the web.config file and that would be it. Well, that is what I am doing. But I was looking for a property where they you set something like ConnectionInfo.Mode = Mode.WindowsAuthentication I guess they don't have that property.   Thanks, Sridhar....

Reporting (Crystal Reports vs. Custom .NET)
Ok, so I have to confess, I have never tried Crystal Reports. I just recently started working for a marketing company now and reporting is VERY important to them.  I am currently migrating a lot of the applications they use from VB5 and VB6 to web based .NET 3.5 apps.   The whole company is running off ACCESS databases if you can believe that.  They sometimes have up to a few hundred agents taking sales on incoming calls and chat sessions and they are all getting streamed to FLAT file records (completely un-normalized database).  I am in the process of developing a c...

Crystal Report - Sub report C#
 Hi, ');" title="Smile - ">         In ASP.Net   How can I create a Sub report with in a Crystal report.         Plz  , send me a sample code in C#. Bye from,    VGS Bye From, Subaramyan.... Look at this: http://www.c-sharpcorner.com/UploadFile/mahesh/MultipleDataSourceReport08232006225431PM/MultipleDataSourceReport.aspxChristopher Reed"The oxen are slow, but the earth is patient." try this link http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-subrepo...

How do I incorporate a crystal report other than the crystal report provided by Visual Studio?
I'm working with the CrystalDecision version of the crystal report. How do I incorporate this into my development?...

How do I deploy an application using crystal reports/install crystal reports?
First of all: C# .NET framework 1.1, IIS 6.0, XP SP1, Windows forms - not ASP.NET but I don't see how it would make a differenceMy Situation: I am tasked with adding to an application the ability to generate a crystal report.  It currently has nothing to do with them.The application runs on an XP system with .NET 1.1 installed but lord only knows how it was installed on there (the guy that set it up is long gone and from past experience with his work I think he was just guessing anyways) In an attempt to see if crystal reports was installed, I wrote a quick test forms appl...

comparing Cystal Report 10.2.3(provided by VS 2005) and Crystal Report 10.0.3(provdied by Crystal reports 10
 hi all, i was just wondering what u guys think about the two version (10.2.3 - by VS2005) and (10.0.3 - by Crystal reports 10).it seems like the Coding syntax is abit diff for the two version. (10.2.3 dont even need to mappath) i was wondering if i write the web application using 10.2.3, would i encounter problems when displaying report written by 10.0.3. opinions need, thanks! regards,martin ...

Crystal Reports in PB Report
Hi All, I want to include crystal report in Powerbuilder datawindow. How can I do this?. Can anyone help me in this regard. Thanks in advance for any help, Smith What are you trying to do? What role do you want PB to play and what role do you want Crystal Reports to play? Are you looking at a C/S application? -- Dean Jones CEO PowerObjects http://www.powerobjects.com (612) 339-3355 Ext. 112 TeamSybase * * Think Sybase * * <Smith> wrote in message news:45237490.288d.1681692777@sybase.com... > Hi All, > > I want to include crystal report in Po...

Crystal reports to Reporting Services
Crystal reports to Reporting Services Is there any way I can convert Crystal reports to Reporting Services instead of creating reports again in Reporting Services?   HI,  JIM.H. You can check out this great article. Hope it helps Converting Crystal to Reporting Services http://blogs.msdn.com/gsnowman/archive/2005/10/12/480305.aspx If i misunderstand you about your question, please feel free to correct me and i will try to help you with more information. I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my p...

Crystal Report in Datawindow Report
Hi All, I want to include crystal report in Powerbuilder datawindow. How can I do this?. Can anyone help me in this regard. Thanks in advance for any help, Smith I have never done this myself. But I went to Dejanews.com and searched for crystal report & powerbuilder and found the following, hope it will help you. Our company (ASTEN) has developed a Crystal Report interface that made Powerbuilder application Crystal-enabled. This interface is based on the Crystal Report Print Engine API. This interface include the following features : - invoking a crystal repor...

Reporting services, Crystal reports ?
Hi, I'm very new in using VS.  How can I export report ?  I find it has Report, Crystal Reports controls in Toolboxs.  If it's possible, please explain the procedures as detail as possible. Thanks a lot ! stephen     I reference some online tutorial about how to use Crystal Report in VS 2005.  Follow the instruction up to connect database using "OLD DB SQL Server" and logon the server.  It prompted me Server name, User ID, Password and Database.  I typed "localhost" for Server name (suggested by tutorial).  Does User ID ...

Dynamic Reporting in Crystal Reports
Hi guys,i am developing a report that is generated from dynamic Datasource ,the report document has just 1 report group/table but the fields are unknown and they should be driven from datasource is there any solution/refrence that u guys suggest in this case? thanx-----------------Dont Forget to mark "Is answer" if the post was helpfulthanx BlueBoy...

An Alternative report to Crystal Reports
I am so utterly frustrated with CrystalReports ReportViewer Control and just making a report in general. I have created a beautiful invoice creator page, and now i gotta print the invoice.  I've spent 4 hours today trying to use a crystal report.  Its unnerving.  I keep getting obscure errors. Or no Data, or data from some other source i dont even know where its coming from. I was wondering what i can use to "VIEW AN INVOICE" on the web without using crystal reports. Im almost at the point of just writing a "printable page" version of my invoice page.  But i want it to...

Schema Reporting (Crystal Reports)
Before I create a report on my database stucture using crystal reports - Is there a tool already out there that will give me a quick report on my schema (not dbunload) Mark PowerDesigner will allow for an entity - relationship diagrams. /ck "Mark Stoker" <m.stoker@stokers.co.uk> wrote in message news:Hr#i6h#KCHA.654@forums.sybase.com... > Before I create a report on my database stucture using crystal reports - Is > there a tool already out there that will give me a quick report on my schema > (not dbunload) > > Mark > > Crystal reports has a tool that helps called SQLConn, and SQLConn32 available from the Seagate Software website. One of the nicer things about this tool is it may show that Crystal reports is seeing things differently than you would expect. I personally found that it may see a timestamp in a view as a string. Darstan ...

Crystal Report Report format
Hi All, Is it possible to import the report format from a microsoft excel file instead of manually recreating the UI in crystal report? If so how may I go about doing it? Thank you. Regards, leroylll...

how to generate reports (not a crystal report)
 how to create reports in asp.net..data coming from an sql server 2005 databse. Using ASP.NET to Create Multi-Page Custom Reports               Make Reports Quickly With ASP.NET and XMLWe All move to our original place.Don't forget.Imran Baloch at3_0506:how to create reports in asp.net..data coming from an sql server 2005 databse. Hi, You can use the ASPNET ReportViewer Control (rdlc) to generate a report with data from database:http://www.codeproject.com/KB/webforms/ReportViewer.aspxhttp://geekswithblogs....

Web resources about - RecordSelectionFormula for both crystal report and sub report... - asp.net.crystal-reports

Resources last updated: 3/8/2016 5:46:46 AM