I h开发者_JAVA百科ave a database with 2 sub forms within a form with fields as below
Sub Form 1: 'Qty Booked In', 'Qty Booked Out' Sub Form 2: 'Total Stock'
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. 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. 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?
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.
精彩评论