DoCmd.RunCommand acCmdPaste [英] DoCmd.RunCommand acCmdPaste

查看:270
本文介绍了DoCmd.RunCommand acCmdPaste的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我不能只使用DoCmd.RunCommand acCmdPaste将剪贴板的内容粘贴到VBA中的Access表中。 Excel可以做到。尝试了一堆代码将string()拆分为单独的字段值,但split函数没有正确解析字符串
。似乎是一件简单的事情,任何帮助都会受到赞赏。

Why can't I just use the DoCmd.RunCommand acCmdPaste to paste the contents of the clipboard into an Access table in VBA. Excel can do it. tried a bunch of code to split() the string into separate fields values but the split function does not parse the string correctly. seems like a simple thing any help would be appreciated.

推荐答案

我将以下代码附加到按钮"下一步"在表格上。   在Access中将PasteAppend转换为表格。

I have the below code attached to a button "Next" on a form.   In Access you PasteAppend into tables.

Private Sub cmdNext_Click()
On Error Resume Next
Application.Echo False
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM tblSelectData"

DoCmd.OpenTable "tblSelectData"
DoCmd.GoToRecord , , acLast
DoCmd.RunCommand acCmdPasteAppend
DoCmd.Close acTable, "tblSelectData"

DoCmd.SetWarnings True
Application.Echo True

End Sub


这篇关于DoCmd.RunCommand acCmdPaste的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆