设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 971|回复: 2
打印 上一主题 下一主题

[与其它组件] EXCEL 5.0 应该改成什么才能成功???

[复制链接]
跳转到指定楼层
1#
发表于 2003-5-4 23:22:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Sub ConnectOutput(dbstemp As Database, _
    strTable As String, strConnect As String, _
    strSourceTable As String)

    Dim tdfLinked As Object 'TableDef
    Dim rstLinked As Object 'Recordset不行
    Dim intTemp As Integer

    ' Create a new TableDef, set its Connect and
    ' SourceTableName properties based on the passed
    ' arguments, and append it to the TableDefs collection.
    Set tdfLinked = dbstemp.CreateTableDef(strTable)


    tdfLinked.Connect = strConnect
    tdfLinked.SourceTableName = strSourceTable
MsgBox tdfLinked.Connect & "\" & tdfLinked.SourceTableName
    dbstemp.TableDefs.Append tdfLinked '4 有问题
   

   Set rstLinked = dbstemp.OpenRecordset(strTable)
   'Set rstLinked = dbsTemp.OpenRecordset(strSourceTable)
    Debug.Print "Data from linked table:"

    ' Display the first three records of the linked table.
    intTemp = 1
    With rstLinked
        Do While Not .EOF And intTemp <= 3
            Debug.Print , .Fields(0), .Fields(1)
            intTemp = intTemp + 1
            .MoveNext
        Loop
        If Not .EOF Then Debug.Print , "[additional records]"
        .Close
    End With

    'Delete the linked table because this is a demonstration.
    dbstemp.TableDefs.Delete strTable

End Sub




Private Sub 命令11_Click()
Dim dbstemp As Database
Dim tablename0 As String
Set dbstemp = OpenDatabase("C:\Documents and Settings\Administrator\桌面\赵工保留\新建文件夹 (6)\db10.mdb")
    databaseconnect = "C:\Documents and Settings\Administrator\桌面\daoSTUDY\vba.xls"
  tablename0 = "hello"


  ConnectOutput dbstemp, _
                "ExcelTable", _
                [B]" Excel  5.0;" & _[/B]
                 "DATABASE" = databaseconnect, _
                  tablename0


[此贴子已经被作者于2003-5-4 20:46:58编辑过]

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2003-5-4 23:25:00 | 只看该作者
微软帮助里的。测试EXCEL时没有成功。
3#
 楼主| 发表于 2003-5-5 04:48:00 | 只看该作者
who can help me?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-5 11:43 , Processed in 0.085630 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表