MS Access VBA等效于Ctrl+'?
我有一个艰难的时间如何从我的用户表格上的上一个记录中正确复制特定的字段数据。我没有代码示例可以显示,但我的请求非常简单。
目前,在12个字段中,我有6个经常重复数据。我可以单击并按 ctrl +'(“从上一个记录中的同一字段插入值”),它执行我想要的任务。但是,它为任务增加了很多时间。我只想编写VBA代码以对那些特定字段执行该命令。
我无法获得sendkeys
工作。 dlast
似乎有时会提供随机数据。我觉得这应该是一个非常简单的请求,但是由于某种原因,我没有找到功能解决方案。
I am having a difficult time how to properly copy specific field data from previous records on my user form. I don't have a code sample to show but my request is very simplistic.
Currently, out of 12 fields, I have 6 that I often repeat data. I can click on and press Ctrl+' ("Insert the value from the same field in the previous record") and it performs the task I want. However, it adds a lot of time to the task. I simply want to write VBA code to perform that command to those specific fields.
I haven't been able to get SendKeys
to work. DLast
appears to provide random data at times. I feel like this should be a very simple request but for some reason I am not finding a functional solution for it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要摆弄数组或查询 - 使用dao 的功率:
顺便说一句,这也是一个很好的例子,说明了
RecordSetClone
和recordset的clone
clone - 第一个是“表单的记录”,而又是第二个是独立副本。这也意味着表单将自动更新和立即。
Don't fiddle with arrays or queries - use the power of DAO:
This also, by the way, is an excellent example of the difference between the
RecordsetClone
and theClone
of a recordset - the first being "the records of the form", while the second is an independant copy.This also means, that the form will update automatically and immediately.
只要编辑简单表的简单表格,并且绑定的数据字段名称与控件名称匹配,则可以逃脱将
其分配给同一表单上的单独按钮。
Provided that it's a simple form to edit a simple table, and that the bound data field names match the control names, you may get away with
which you assign to a separate button on the same form.
您已经有一个好主意帖子了。
您也可以说将功能放在之前的插入事件中。此事件只有在您开始输入新的recrd时就会发射,并且它变得肮脏。
因此,也许这样做:
要设置控件/字段的“列表”或“数组”的一些好主意,因此您不必编写很多代码。 (如在其他帖子/答案中所建议的那样)
You have a good idea post here already.
You could also say place a function in the before insert event. This event ONLY fires when you start typing into a NEW reocrd, and it becomes dirty.
So, maybe this:
And some good ideas in say having a "list" or "array" of controls/fields to setup, so you don't have to write a lot of code. (as suggested in the other post/answer here)