光纤熔接 ERP

弱电论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 645|回复: 0
打印 上一主题 下一主题

用ADO来导出所有表的所有字段

[复制链接]
跳转到指定楼层
1#
发表于 2012-3-27 16:32:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
华为代理商
  1. Function ExportColumns()
  2. DoCmd.RunSQL "delete * from A" 'A表为目标存放位置
  3. Dim Conn As ADODB.Connection
  4. Dim Rs As ADODB.Recordset
  5. Dim i As Integer
  6. Dim Str As String
  7. Dim Str1 As String
  8. Dim Str2 As String
  9. Dim Str33 As String
  10. Set Conn = CurrentProject.Connection
  11. Set Rs = Conn.OpenSchema(adSchemaColumns, Array(Empty, Empty, Empty, Empty))
  12. Do Until Rs.EOF
  13. 'If Mid(Rs!table_name, 1, 1) <> "M" And Mid(Rs!table_name, 1, 1) <> "A" Then
  14. If Mid(Rs!table_name, 1, 1) <> "M" Then
  15. Str = Nz(Rs!table_name)
  16. Str1 = Nz(Rs!Description)
  17. Str2 = Nz(Rs!column_name)
  18. DoCmd.RunSQL "insert into A (Tnam,des,Cnam) values (" & "'" & Str & "'" & "," & "'" & Str1 & "'" & "," & "'" & Str2 & "'" & ")"

  19. End If
  20. Rs.MoveNext
  21. Loop
  22. DoCmd.TransferSpreadsheet acExport, 8, "A", "Path", False, ""
  23. End Function
复制代码

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|广告咨询|VIP注册|关于我们|联系我们|积分规则|手机版|Archiver|弱电之家论坛 ( 京ICP备11008917号-3 )

GMT+8, 2025-7-17 23:57 , Processed in 0.097080 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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