Excel to Access,将数据类型更改为按钮单击操作的一部分
Posted
技术标签:
【中文标题】Excel to Access,将数据类型更改为按钮单击操作的一部分【英文标题】:Excel to Access, change data types as part of a button's on click action 【发布时间】:2015-07-16 14:20:30 【问题描述】:我每天两次在 SAP 中运行 2 份报告(我只有用户级权限),需要在 Access 中结束。当前流程如下所示:
(1) Run report one, select the fields I need, export to Excel.
(2) Run a saved import within Access to get the table.
(3) Switch that table to design view so I can edit the data types to sync with the table I intend to update.
(4) Run an append query.
(5) Rinse and repeat for report 2.
由于我希望将此任务委托给用户,因此我想要一个将流程更改为的按钮:
(1) Run report one, select the fields I need, export to Excel.
(2) Click the "import, change data type and append" button.
(3) Rinse and repeat for report 2.
Excel 文档的格式如下所示:
txtField1 txtField2 txtField3 txtField4 txtField5 DateAndTimeField1
它还使用与 Access 不同的命名约定。
访问需求:
TxtField1 txtField2 NumberField1 NumberField2 NumberField3 DateAndTimeField1
我可以使用macro 将 Excel 文档导入 Access,然后只需将附加查询添加到按钮的操作即可。但除非数据类型同步,否则我无法将其附加到我想要的表中。
如何在按钮的单击操作中切换导入文档上的数据类型和(如果使用 vba)列标题?
【问题讨论】:
【参考方案1】:也许试试Range("A1").NumberFormat
或者,Range("D2").Value = Val(Range("C2").Value)
Val()
函数。
【讨论】:
以上是关于Excel to Access,将数据类型更改为按钮单击操作的一部分的主要内容,如果未能解决你的问题,请参考以下文章
如何使用vba在excel2010中将保存类型从excel工作簿更改为excel 97-2003?
我在数据框中的一列(字符串+浮点数)中混合了值我如何将它们更改为对象 [重复]