Results 1 to 4 of 4

Thread: subscript out of range run time error '9' vb6 crystal report

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    93

    subscript out of range run time error '9' vb6 crystal report

    I am getting this error when I try to pass an sql string to an external crystal report. extenal in the the report is not part of the project but a crystal report file. I have uploaded a summarised version of the project

    Code:
    Dim Report As New CrystalReport1
    
    Set rs = New ADODB.Recordset
    Dim strSql As String
    
    Dim ReportStartDate As Date
    Dim ReportEndDate As Date
    
    ReportStartDate = txtStartDate.Text
    ReportEndDate = txtEndDate.Text
    
    strSql = "SELECT * from Outwards WHERE date >= #" & ReportStartDate & "#  And date <= #" & ReportEndDate & "# and ShiftNumber >= " & txtStartShift.Text & " And ShiftNumber <= " & txtEndShift.Text & ""
    'rs.Open strSql, Con
    rs.Open strSql, Con, adOpenKeyset, adLockOptimistic, adCmdText
    
    
    Report.DiscardSavedData
    Report.Database.Tables(1).SetDataSource rs, 3'>>> Where the error shows up
    
    CRViewer1.ReportSource = Report.Application.OpenReport("C:\CrystalSample\NOPS36.rpt")
    
    CRViewer1.Refresh
    CRViewer1.ViewReport
    
    Set Report = Nothing
    Set rs = Nothing
    Attached Files Attached Files

  2. #2

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    93

    Re: subscript out of range run time error '9' vb6 crystal report

    I tried and its still giving me the same error

  4. #4
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: subscript out of range run time error '9' vb6 crystal report

    Try loading the rpt first
    and after that set the datasource
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

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