简体   繁体   English

在子窗体中创建新记录按钮单击 MS Access 2013 VBA

[英]Create a New Record in a SubForm on button click MS Access 2013 VBA

I have a main form called MForm on that form I have a subform that is a datasheet called SForm .我在该表单上有一个名为MForm的主表单,我有一个子表单,它是一个名为SForm的数据表。

What I would like to do: On MForm I have a button called cmdNew when I click that button I would like to create a new record inside subform.我想做什么:在 MForm 上,当我单击该按钮时,我有一个名为 cmdNew 的按钮,我想在子窗体中创建一个新记录。

But I am not sure what the VBA would look like in order to make that happen.但我不确定 VBA 会是什么样子才能实现这一目标。

On the button all you need to do is this:在按钮上,您需要做的就是:

Me!SForm.SetFocus
DoCmd.GoToRecord , , acNewRec

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

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