|
-
May 28th, 2008, 04:33 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Error in setting Parameter for SubReport?
I'm using CR 11 and have a report in which it has 3 subreports. I'm calling the main report from a VB.Net app. The 3 subreports have 2 parameters each. They also have a Stored Procedure in each of them. lHowever, I'm getting an "Object reference not set to an instance of an object" error on the highlighted line of code. I don't think I've set my parameters up correctly for the subreports. I don't know this for sure because this is the first time I've ever used parameters in a subreport. Any ideas?
Code:
Public Function PrintGroupActivitySummary(ByVal strUserID As String, _
ByVal intGroupID As Integer)
Try
Dim crDoc As New rptGroupActivitySummary
Dim crSub1 As New ReportDocument
Dim crSub2 As New ReportDocument
Dim crSub3 As New ReportDocument
With crConnectionInfo
.ServerName = "HERCULES"
.DatabaseName = "Drip"
.UserID = "CRVBNETSQL"
.Password = "SC1800fuels"
.IntegratedSecurity = True
End With
crSub1 = crDoc.OpenSubreport("IRStatus.rpt")
crSub2 = crDoc.OpenSubreport("Over3Days.rpt")
crSub3 = crDoc.OpenSubreport("OutstandingIR.rpt")
crSub1.SetParameterValue("@userID", strUserID)
crSub1.SetParameterValue("@groupID", intGroupID)
crSub2.SetParameterValue("@userID", strUserID)
crSub2SetParameterValue("@groupID", intGroupID)
crSub3.SetParameterValue("@userID", strUserID)
crSub3.SetParameterValue("@groupID", intGroupID)
PrintGroupActivitySummary = crDoc
Catch ex As Exception
rptErr.clsProcedure = "PrintGroupActivitySummary()"
rptErr.clsMsg = ex.Message
rptErr.WriteToTextFile(ErrorDirectory, "DRIP-ErrorLog.txt")
End Try
End Function
I'm gettin' desparate folks.
Thanks,
Last edited by blakemckenna; May 29th, 2008 at 12:33 PM.
Blake
-
May 28th, 2008, 08:55 PM
#2
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
Any ideas? I'm really cuttin' this to the bone...
-
May 29th, 2008, 01:28 PM
#3
Frenzied Member
Re: Error in setting Parameter for SubReport?
You do not have to pass the parameters that many times if they are all the same value. If you go into crystal reports and right click on your sub report you can link the parameters from the main report to the sub report parameter fields.
-
May 29th, 2008, 01:42 PM
#4
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
Besoup,
The main report does not have any parameters. It's just the 3 subreports that have identical params.
-
May 29th, 2008, 01:42 PM
#5
Frenzied Member
Re: Error in setting Parameter for SubReport?
ok then you can just add parameter fields to the main report and link them to your subs....
-
May 29th, 2008, 02:13 PM
#6
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
Why do I keep getting prompted in my VB.Net app to enter the paramater values then?
-
May 29th, 2008, 02:17 PM
#7
Frenzied Member
Re: Error in setting Parameter for SubReport?
If you have them linked properly in CR then all you would need is this code:
vb Code:
Public Function PrintGroupActivitySummary(ByVal strUserID As String, _
ByVal intGroupID As Integer)
Try
Dim crDoc As New rptGroupActivitySummary
With crConnectionInfo
.ServerName = "HERCULES"
.DatabaseName = "Drip"
.UserID = "CRVBNETSQL"
.Password = "SC1800fuels"
.IntegratedSecurity = True
End With
crDoc.SetParameterValue("@userID", strUserID)
crDoc.SetParameterValue("@groupID", intGroupID)
PrintGroupActivitySummary = crDoc
Catch ex As Exception
rptErr.clsProcedure = "PrintGroupActivitySummary()"
rptErr.clsMsg = ex.Message
rptErr.WriteToTextFile(ErrorDirectory, "DRIP-ErrorLog.txt")
End Try
End Function
-
May 29th, 2008, 02:25 PM
#8
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
Using your exact code....I'm still getting prompted 3 times (1 for each subreport) to enter 2 parameter values.
-
May 29th, 2008, 02:33 PM
#9
Frenzied Member
Re: Error in setting Parameter for SubReport?
can you post a screenshot of how one of your links look?
-
May 29th, 2008, 02:36 PM
#10
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
Here is a screen shot. I am trying to link the subreport to the main report parameters...
-
May 29th, 2008, 02:37 PM
#11
Frenzied Member
Re: Error in setting Parameter for SubReport?
change the bottom selection on the left to ?@groupid without the prefix.
-
May 29th, 2008, 02:46 PM
#12
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
didn't work....still prompted me as well as the attached Error.
-
May 29th, 2008, 02:54 PM
#13
Frenzied Member
Re: Error in setting Parameter for SubReport?
may seem like a dumb question but did you change them for all 3 sub reports?
-
May 29th, 2008, 02:56 PM
#14
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
Not a dumb question!!! But yes...I did.
-
May 29th, 2008, 04:26 PM
#15
Thread Starter
PowerPoster
Re: Error in setting Parameter for SubReport?
Somehow, I've resolved it. Don't know exactly what I did except for what Besoup suggested and by updating the SP's.
-
Jul 9th, 2008, 05:14 PM
#16
Thread Starter
PowerPoster
Re: [RESOLVED] Error in setting Parameter for SubReport?
The same problem is back and I don't know what I did.
-
Jul 11th, 2008, 09:08 AM
#17
Thread Starter
PowerPoster
Re: [RESOLVED] Error in setting Parameter for SubReport?
How do I reopen this thread?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|