简体   繁体   English

子窗体未从Access 2010中的其他子窗体输入更新

[英]Subform not updating from other subform input in Access 2010

I have a database with 2 sub forms within a form with fields as below 我有一个数据库,其中包含2个子表单,表单中的字段如下所示

Sub Form 1: 'Qty Booked In', 'Qty Booked Out' Sub Form 2: 'Total Stock' 子表格1: “已入库数量”,“已出库” 子表格2: “存货总额”

When running in Access 2003, the 'Total stock' field is updated when a 'Refresh' button is clicked depending on the values entered into the 'Booked in' or 'Booked out' fields. 在Access 2003中运行时,单击“刷新”按钮时将更新“总库存”字段,具体取决于在“预订”或“预订”字段中输入的值。 This is done using the following code and works fine: 使用以下代码即可完成此操作,并且效果很好:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

When I open this database in Access 2010, the 'Total Stock' field will not update. 当我在Access 2010中打开此数据库时,“总库存”字段将不会更新。 I have tried amending the code to the below, with no success. 我尝试将代码修改为以下内容,但没有成功。

DoCmd.RunCommand.acCmdRefresh

I have also tried the following code with no success either: 我也尝试了以下代码,但均未成功:

DoCmd.RunCommand acCmdSaveRecord

I'm not an Access expert by any means but was just wondering if there is something obvious that I have missed? 我无论如何都不是Access专家,只是想知道我是否错过了明显的事情?

Thanks 谢谢

I have managed to solve this myself: 我设法自己解决了这个问题:

Me.TblQty.SetFocus
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , , acNewRec
Me.TblQty_Query.SetFocus
Me.TblQty_Query.Requery

Try 尝试

Me.Recalc

DoMenuItem is long since deprecated. DoMenuItem早已不推荐使用。

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

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