如何确保 MS Access 中的有界表单和子表单仅在单击按钮后提交到数据库?
有关该问题的一些信息,我正在修复一个旧的 Access 数据库,该数据库的表单绑定到表“tblMain”,子表单绑定到表“tblSub”,并且 tblMain 与 tblSub 之间的关系是一对多,其中 tblSub有一个名为“belongs_to”的字段,它是 tblMain 中拥有它的记录的 id 字段。
因此,主窗体保存一条记录,子窗体保存与该主记录相关的许多记录。
有什么办法让我告诉这两个表单等待更新到数据库,直到按下按钮后?
A little information about the problem, I am fixing an old Access database that has a form bounded to a table "tblMain" and the subform is bounded to a table "tblSub" and the relationship between tblMain to tblSub is one to many, where tblSub has a field called belongs_to which is the id field of the record in tblMain that owns it.
So the main form holds one record and the subform holds many records that are tied to that one main record.
Is there any way for me to tell the two forms to wait to update to the database until after a button has been pressed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有简单的方法可以满足您的要求。它基本上归结为使用未绑定的表单并手动处理插入/更新。
我认为您可以使用使用 adLockBatchOptimistic 打开的 ADO 记录集来执行此操作,但我对此没有具体的答案。
我建议您坚持使用 MS Access 的默认行为,或者考虑在 .Net 中开发您的解决方案,其中批量更新是默认行为。
There is no easy way to do what you are asking for. It basically comes down to use unbound forms and manually handling the inserts/updates.
I think you could possibly do this with an ADO recordset that is opened using adLockBatchOptimistic but I don't have a concrete answer on this.
I recommend you stick with the default behavior of MS Access or consider developing your solution in .Net where batch updating is the default behavior.