vba - 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...
解决方案
发现了问题。我创建的导出规范使用点作为十进制符号。将小数点符号改回,
并将字段分隔符从,
更改为后;
,我的问题中的代码按预期工作。
推荐阅读
- twilio - 使用带有 JSON 的 Twilio 验证服务 API
- verilog - 为什么我不能在 Verilog 的“总是”块中将寄存器的内容复制到另一个?
- sql - 如何在SQL中比较不同表中列中的两个字符串
- php - Laravel 查询字符串到路由中的 api 调用
- bazel - 在 Bazel 中使用绝对路径是否安全?
- python - 任何人在以长复杂代码导入图像时遇到问题
- python - 如何将 8 个皇后谜题的解旋转 90 度?
- html - 如何在导航栏的内容中从左右提供空间
- mysql - MYSQL,如何设计一个“add0remove”用户设置表?
- firebase - 如何为每个用户创建一个新页面?