For Each Sect In oRpt.Sections
        For Each RptObject In Sect.ReportObjects
            If RptObject.kind = 5 Then
                Set subrpt = RptObject
                Set subrpt1 = subrpt.OpenSubReport()
                Set db = subrpt1.Database
                Set dbtables = db.Tables
                For i = 1 To dbtables.Count
                    Set dbtable = dbtables.Item(i)
                    dbtable.SetLogOnInfo CStr(odbc_name), CStr(base_name), "sa", CStr(oldpwd))
                    Set dbtable = Nothing
                Next
                Set dbtables = Nothing
                Set db = Nothing
                Set subrpt1 = Nothing
                Set subrpt = Nothing
            End If
        Next
    Next
    Set Sect = Nothing

解决方案 »

  1.   

    Dim oApp As New CRAXDRT.Application
        Dim orpt As CRAXDRT.Report
        Dim Sect As CRAXDRT.Section
        Dim subrpt As CRAXDRT.Report
        Dim subrpt1 As CRAXDRT.Report
        Dim db As CRAXDRT.Database
        Dim dbtables As CRAXDRT.DatabaseTables
        Dim dbtable As CRAXDRT.DatabaseTable
      

  2.   

    With CRpt
         .Connect = "Password=" & pass & ";User ID= " & user & ";DSN=" & data & ";DSN=" & server
          .ReportTitle = "药品入库单"
          .ReportFileName = App.Path & "\Rpt\Rpt.rpt"
          .SelectionFormula = "{VW.id}=" & rs!id
          .Action = 1
    End With
      

  3.   

    请问CRAXDRT是什么对象,如何引用
      

  4.   

    请问 zxmoon(晓月) 
    CRpt 是什么类型的变量
      

  5.   

    CRAXDRT is Crystal Report RunTime.