如何在添加记录中打开表单
我有一个将记录输入到表中的表单。我希望它在空添加(新建)上打开,而不是显示表的第一条记录。由通过按钮打开输入表单的导航表单使用。
I have a form to input records to a table. I would like it to open on an empty add (New) instead of displaying the first record of the table. To be used by a Navigation Form which opens the input form from a button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用
acFormAdd
(value = 0) 作为OpenForm
的可选DataMode
参数。 Access 的帮助将acFormAdd
描述为“用户可以添加新记录,但无法编辑现有记录。” 实际上,这不仅会阻止编辑现有记录,甚至不显示在带有该选项的表单中。如果您希望始终以这种方式使用表单,可以将其数据输入属性设置为
Yes
(在表单属性表的“数据”选项卡上)。You can use
acFormAdd
(value = 0) as the optionalDataMode
argument toOpenForm
. Access' help describesacFormAdd
as "The user can add new records but can't edit existing records." And actually, not only does that prevent editing of existing records, they are not even displayed in the form with that option.If you want to always use the form that way, you can set its Data Entry property to
Yes
(on the Data tab of the form's property sheet).在
Form_Load
事件中使用GoToRecord
DoCmd 方法并传入acNewRec
作为 Offset。In the
Form_Load
event use theGoToRecord
Method of DoCmd and pass inacNewRec
for the Offset.在属性表上,将“数据输入”设置为“是”。
您也可以关闭导航按钮。
On the property sheet, set "Data Entry" to Yes.
You can turn off navigation buttons too.