Results 1 to 17 of 17

Thread: [RESOLVED] Error in setting Parameter for SubReport?

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Resolved [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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width