excel - Access 换行符成为_x000D_

标签 excel ms-access excel-formula newline

我正在尝试根据 Excel 中的数据生成 Access 权限报告。因此,我使用外部数据选项在 Access 中导入 Excel 工作表,但我的换行符始终显示为“_x000D_”

作为示例,我使用一个包含 4 列的 Excel 工作表,所有列均带有标题,并且全部包含 1 行数据,按从左到右的顺序包含:

="a"&char(10)&"b" 
="a"&char(13)&"b" 
="a"&char(10)&char(13)&"b" 
="a"&char(13)&char(10)&"b"

在我的 Excel 工作表中,我尝试将换行符更改为我能想到的所有内容,但似乎做了一些事情的两个是 char(10) 和 char(13),但是 char(10) 没有出现在 Access 中all 和 char(13) 似乎变成“_x000D_”

最佳答案

参见How to import from Excel and keep the line breaks :

Excel uses line-feed character (ASCII 10) as the line separator, while Access uses the combination of carriage-return + line-feed (ASCII 13 followed by ASCII 10) as the line separator.

After importing, you can use the Replace function to replace Chr(10) with Chr(13)+Chr(10). For example, you could execute a query like this:

UPDATE ImportedExcelTable SET MyField = Replace([MyField], Chr(10), Chr(13) & Chr(10));

因此,在 Excel 单元格中添加换行符的唯一正确方法是第一个版本:

="a"&char(10)&"b"

导入表后,使用更新查询将 Lf 替换为 Access 换行符 CrLf

关于excel - Access 换行符成为_x000D_,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36167807/

相关文章:

ms-access - MSaccess 如何为源代码管理导出链接表 ODBC 连接构建,(包括表关系)

.net - 尝试对 MS Access 执行 "REPLACE"时出现异常

java - 是什么原因导致此 "invalid cursor state"错误?

excel - 创建 Excel 层次结构

excel - Excel中有没有办法重置累计总数?

c# - 如何根据其他表格填写数据验证下拉列表?

excel - 以编程方式从 Excel 数据创建 [邮件合并] PowerPoint 幻灯片

vba - 范围 - VBA - 为什么这段代码不起作用?

excel - 当Excel中两个值的频率相同时,如何获得它们的结果?

excel - 引用 Excel 公式中的最后一行