Results 1 to 2 of 2

Thread: Sub To Open Strongly Typed Objects

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    259

    Sub To Open Strongly Typed Objects

    I am including my Crystal Reports as Resources in my ClickOnce application so that I can include them without having to worry about file security (users on an untrusted domain).

    The only way to accomplish this, at least as far as I can tell, is to use a Strongly Typed Report Object. My problem is that I want to keep the report name generic so I can call it with arguments instead of hardcoding as I do below.
    Code:
        Private Sub OpenCR_v2()
            Dim aReport As New CountSheets
            aReport.SetParameterValue("isAdmin", isAdmin)
            aReport.SetParameterValue("parStoreID", StoreID)
            aReport.SetDatabaseLogon("User", "pass", "db", "Table")
            crvReports.ReportSource = aReport
        End Sub
    How can I accomplish opening different reports in my sub while still using the Strongly Typed Report Object? For instance CountSheets is the name of the report above but I also want to use the same Sub to open other reports.
    Last edited by FastEddie; Aug 13th, 2007 at 01:12 PM.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    259

    Re: Sub To Open Strongly Typed Objects

    Well this isn't what I had in mind but I did make this work.
    Code:
        Private Sub OpenCR_v2()
            Dim aReport As ReportDocument
            aReport = Nothing
            Select Case intFileID
                Case 0 : aReport = New Variances
                Case 1 : aReport = New CountSheets
            End Select
            aReport.SetParameterValue("isAdmin", isAdmin)
            aReport.SetParameterValue("parStoreID", StoreID)
            aReport.SetDatabaseLogon("User", "pass", "db", "Table")
            crvReports.ReportSource = aReport
        End Sub

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