Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-窗体/数据页

【Access示例】导出所有表为CSV文件

时 间:2018-03-09 08:36:28
作 者:缪炜   ID:24010  城市:江阴
摘 要:将所有的表,批量导出成CSV格式
正 文:

Sub ExportCSV()
    Dim strOut As String
    Dim tbl As AccessObject


    With Application.FileDialog(4)   
        .Title = "Please select the target folder"
        If .Show Then
            strOut = .SelectedItems(1)
            If Not Right(strOut, 1) = "\" Then
                strOut = strOut & "\"
            End If
        Else
            MsgBox "You didn't select a target folder.", vbExclamation
            Exit Sub
        End If
    End With


    For Each tbl In CurrentData.AllTables
        If Not tbl.Name Like "MSys*" And Not tbl.Name Like "~" Then

            DoCmd.TransferText acExportDelim, , _
                               tbl.Name, strOut & tbl.Name & ".csv", True
        End If
    Next tbl
End Sub

附   件:

点击下载此附件


演   示:



Access软件网QQ交流群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助