请高手看看 那有问题啊 代码如下:
Private Function rep()
 Dim StrSql As String
 StrSql = "select * from purapp where jlrq >= '" & Me.date1.Value & "' and jlrq <='" & Me.date2.Value & "'"
 Unload frmReport
 MsgBox "===="
 Call frmReport.OpenReport(StrSql, App.Path & "\" & sysInfo.strRptPath & Me.Tag & ".rpt", Me.Caption)
 MsgBox "------->"
End Function

解决方案 »

  1.   

    我查了一下 主要是  Call frmReport.OpenReport(StrSql, App.Path & "\" & sysInfo.strRptPath & Me.Tag & ".rpt", Me.Caption)
    这句有错误  但是我这里没有用到数组  怎么就提示数组越界了。
      

  2.   

    上OpenReport 的代码
    水晶报表
      

  3.   


    Public Function OpenReport(ByVal StrSql As String, ByVal StrReport As String, Optional ByVal Title As String)
        
        On Error GoTo Out:
        
        Screen.MousePointer = 13
        Conn.Open sysInfo.strConn
        Rs.Open StrSql, Conn, adOpenStatic, adLockOptimistic
            Set M_Report = rptApp.OpenReport(Trim(StrReport))    M_Report.DiscardSavedData
        M_Report.Database.SetDataSource Rs
        CRNNViewer1.ReportSource = M_Report
        CRNNViewer1.ViewReport
        
        Me.Show
        Me.Caption = "--" & Title
        
        Screen.MousePointer = 0
        
        Exit Function
    Out:
        Screen.MousePointer = 0
        If Err.Number = -2147206461 Then
            MsgBox "⊿Τт厨,叫谔﹚厨隔畖タ谔!", vbOKOnly + vbCritical, sysInfo.StrMsg
        Else
            MsgBox Err.Number & vbLf & Err.Description, vbOKOnly + vbCritical, sysInfo.StrMsg
        End If
        
        If Rs.State = adStateOpen Then
            Rs.Close
            Set Rs = Nothing
        End If
        If Conn.State <> 0 Then
            Conn.Close
            Set Conn = Nothing
        End If
        
    End Function
    以上是openreport代码  
    谢谢,麻烦在看看。