无法将TransferText导出到CSV,但是可以将TransferSpreadsheet导出到XLSX [英] TransferText export to CSV not working, but TransferSpreadsheet to XLSX working

查看:230
本文介绍了无法将TransferText导出到CSV,但是可以将TransferSpreadsheet导出到XLSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个表单,在其中创建了一个按钮,并通过上下文菜单激活了VBA的代码生成器. 单击该按钮后,查询将正确导出为.xlsx:

I created a Form in which I created a button and through the context menu I activated the Code-generator for VBA. On a click on the button, the query is correctly exported as .xlsx:

Option Compare Database

Private Sub Befehl0_Click()

            DoCmd.TransferSpreadsheet acExport, , "queryname", "C:\test\queryname.xlsx", -1

End Sub

但是,当我修改导出时(根据此常见问题解答):

However, when I modify the export (according to this FAQ):

Option Compare Database

Private Sub Befehl0_Click()

            DoCmd.TransferText acExportDelim, , "queryname", "C:\test\queryname.csv", -1

End Sub

什么都没发生.

我也尝试过设置导出规范",但这也无济于事.

I've also tried setting an Export Specification, but that doesn't help either.

这是怎么了?

推荐答案

答案是存在错误"3441"文本文件规范字段分隔符与十进制分隔符或文本定界符匹配",该错误仅在尝试时可见在直接窗口(Ctrl + G)中运行它.

The answer to this was that there was an error '3441' "Text file specification field separator matches decimal separator or text delimiter", which was only visible when trying to run it in the Direct-window (Ctrl+G).

显然,当您使用非英语操作系统时,这是分隔符默认设置的问题.

Apparently, when you use a non-English OS this is a problem with the default setting for the delimiters.

要解决此问题,必须提供一个导出规范.但是,有两种方法可以创建这种方法,其中一种是错误的.

To solve it, an Export Specification has to be provided. However, there are two ways to create such, one of which is wrong.

导入也是如此,为此,我在网上找到了:

The same is true for importing, for which I found this on the web:

"是的,我已经创建了规范,并且可以通过导入"来查看 向导,但是在MSysIMEXSpecs中没有一行."然后,它 似乎您可能尚未创建真正的导入规范.

"Yes i had created the Specification and it is viewable via the Import Wizard, however there is no line for it in MSysIMEXSpecs." Then it seems that you may not have created a true import Specification.

在Access 2007和更高版本中,您还可以保存导入步骤".这 与导入规范中的不同.

In Access 2007 and newer you can also save the "Import Steps". This is not the same thing as in Import Specification.

已保存的导入"将不会显示在MSysIMEXSpecs中,但是会显示为"true". 导入规范应该.

A "Saved Import", will not show up in MSysIMEXSpecs, but a true Import specification should.

请确保,... 在导入过程中,如果您单击 高级"按钮可实际创建导入规范.

To be sure, ...during the import process steps, if you click the "Advanced" button to actually create the Import Specification.

导入过程的最后一步是保存导入步骤"对话框 框,...再次,这与导入规范不是相同.一种 已保存的导入/导出"将在以下位置提供: 外部数据->导出->保存的导出...所以也请在此处检查

The last step of the import process is the "Save Import Steps" dialog box, ...again, this is not the same thing as an Import Spec. A "Saved Import/export" will be available under: External Data-->Export-->Saved Export ...so check here as well

使用此知识,可以通过添加在上述过程中创建的导出规范"exportcsv"来工作.

Using this knowledge, it works by adding the Export Specification "exportcsv" created in the above process.

        DoCmd.TransferText acExportDelim, "exportcsv", "queryname", "C:\test\queryname.csv", -1

这篇关于无法将TransferText导出到CSV,但是可以将TransferSpreadsheet导出到XLSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆