如何强制“新记录写入” [英] How to force a "new record write"
问题描述
我有一个包含子表单的表单,此子表单允许仅使用几个必要字段添加新的子记录。通常,在输入这几个字段后,用户继续填写其余字段,并通过单击按钮打开一个单独的表单来显示该操作,该表单显示新子记录的所有字段。
问题是它没有。它显示单独的表单,但显示在空白记录而不是新添加的记录上。如果用户将缩略形式的光标移动到不同子记录的字段中,然后单击该按钮,则单独的表单将显示新添加的记录。
我该怎么办?强制写入子记录(可能在单独表单按钮的代码中)?
I have a form with a subform, and this subform allows the addition of a new child record using only a few essential fields. Typically, after entering these few fields, the user goes on to fill in the rest of the fields, and that action happens by clicking on a button that opens a separate form that displays all the fields for the new child record.
The problem is that it doesn''t. It displays the separate form, but on a blank record rather than the newly added record. If the user moves the cursor in the abbreviated form into a field for a different child record, and THEN clicks on the button, the separate form displays the newly added record.
How can I force the child record to be written (probably, in the code for the "separate form" button)?
推荐答案
您可以强制保存记录通过将子表单对象本身的Dirty属性设置为False来实现子表单。当然,如果在保存之前违反了子表单上的任何控件的验证规则,输入掩码,必需属性,则这不会停止错误消息。在下面的代码中替换下面的主表单和子表单名称:
You can force the Save of a Record in a Sub-Form by setting the Dirty Property of the Sub-Form Object itself to False. This, of course, will not stop Error Messages if Validation Rules, Input Masks, Required Property of any Control on the Sub-Form is violated prior to the Save. Substitute your Main Form and Sub-Form Names below in the following Code:
我不知道它是什么是关于这个应用程序的语法让我这么难,但除了给出错误之外,我根本无法让这一行做任何其他事情。这是附加到单独表格的整个模块。按钮:
I don''t know what it is about this application''s syntax that stumps me so, but I simply could not get this line to do anything other than give an error. Here is the whole module that''s attached to the "go to the separate form" button:
使用我在Post#2中展示的语法,即:
Use the Syntax that I showed you in Post# 2, namely:
这篇关于如何强制“新记录写入”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!