首页 > 解决方案 > Dot inside VBA string of an Access application gets interpreted as a number sign upon execution

问题描述

I'm working on a small Access database application that, among other things, exports a csv file when requested by the user.

The csv file should be created by the following code:

DoCmd.TransferText acExportDelim, "CSVexport", "tblExport", sLoc & Format(Date, "ddMMyyyy") & "_" & category & "_Export.csv", True

After fixing an issue with the data source part of the export (changed it from a query to a table), the _Export.csv part suddenly gets interpreted by Access as _Export#csv.

The error I'm getting:

Run-Time error '3011': The Microsoft Access database engine could not find the object '03022020_AluKippers_Export#csv'. Make sure the object exists and that you spell its name and path correctly . If '03022020_AluKippers_Export#csv' is not a local object, check your network connection or contact the server administrator.

I have no idea what's causing this.

Update: When changing the file extension to .txt, I get the same error. When using anything else after the dot, I get the cannot update error. I suspect the error may have something to do with the saved specification CSVexport...

标签: vbams-access

解决方案


发现了问题。我创建的导出规范使用点作为十进制符号。将小数点符号改回,并将字段分隔符从,更改为后;,我的问题中的代码按预期工作。


推荐阅读