简体   繁体   English

Ms Access 中如何将access 中列的数据类型从短文本转换为日期?

[英]How to convert the data type of a column in access from short text to date in Ms Access?

I am importing data from Excel to Access Table using VBA.我正在使用 VBA 将数据从 Excel 导入到 Access Table。 One of the column has date in the form dd.mm.yyyy but it is stored as short text.其中一列的日期格式为 dd.mm.yyyy,但它存储为短文本。 How can I change the short text data type to date as dd.mm.yyyy.如何将短文本数据类型更改为 dd.mm.yyyy 日期。

Initially I had set the table column as type date but I was not able to import data due to data type mismatch.最初我将表列设置为日期类型,但由于数据类型不匹配而无法导入数据。

Therefore, once the data is in the access table, I would like to change the data type to date with format dd.mm.yyyy.因此,一旦数据在访问表中,我想将数据类型更改为日期格式为 dd.mm.yyyy。

向表中添加一个新字段 TrueDate,并使用以下表达式更新它:

DateSerial(Mid([TextDate], 7), Mid([TextDate], 4, 2), Mid([TextDate], 1, 2))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM