Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将主窗体上的按钮单击事件引用到子窗体,类似于:
DoCmd.GoToRecord , , acNewRec
我想使用子窗体来查看和输入新记录,但我的按钮在主窗体上。
SetFocus到子窗体控件,然后执行GoToRecord.
SetFocus
GoToRecord
Private Sub cmdAddSubRow_Click() Me.SubControlName.SetFocus DoCmd.GoToRecord , , acNewRec End Sub
将SubControlName替换为子表单控件的名称,而不是包含在该控件中的表单的名称。这是一个经常绊倒人们的重要点。