报表连接时怎么样才可以用相对的路径???
请大家帮帮忙

解决方案 »

  1.   

     Pname = App.Path & "\report\temp.xls"
      

  2.   

    Dim xlApp As New Excel.Application                     '定义数据库记录集及excel对象变量
        Dim xlBook As New Excel.Workbook
        Dim xlSheet As New Excel.Worksheet
        Dim reStr As String, Pname As String    Pname = App.Path & "\report\temp.xls"                 '定义临时打印工作表
        reStr = Dir(Pname)
        If reStr <> "" Then
            Kill Pname
        End If
        FileCopy App.Path & "\report\医院内部动态报表.xls", Pname
        If Not (xlApp Is Nothing) Then
            xlApp.Quit
        End If
        Set xlApp = CreateObject("Excel.Application")
        xlApp.Visible = True
        Set xlBook = xlApp.Workbooks.Open(App.Path & "\report\temp.xls")
        Set xlSheet = xlBook.Worksheets("动态报表")
        
        xlSheet.Cells(5, 5) = Txt(6).text
        xlSheet.Cells(5, 18) = DTPstart.Value & "------" & DTPend.Value
        xlSheet.Cells(27, 3) = DTPreport.Value
        xlSheet.Cells(27, 21) = Txt(4).text
        xlSheet.Cells(27, 34) = Txt(3).text
      

  3.   

    我是用自带的设计器报表的,用DataEnvironment1连接数据库Access,用DataReport1显示数据库的内容(即报表),请问如何使用(DataEnvironment1连接数据库Access)相对的路径??
      

  4.   

    放在报表的如下事件中:
    Private Sub DataReport_Error(ByVal JobType As MSDataReportLib.AsyncTypeConstants, ByVal Cookie As Long, ByVal ErrObj As MSDataReportLib.RptError, ShowError As Boolean)........
    End Sub
      

  5.   

    用以下方法
    Private Sub DataEnvironment_Initialize()
        conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & IIf(Right(App.Path, 1) = "\", "", "\") & "\A.mdb"End Sub
    另外你还要在设计模式下将DEconnection对象的connectstring清空.