vba 无法编辑 Access 表单中的数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5196894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 12:46:14  来源:igfitidea点击:

Cannot edit data in an Access form

ms-accessvba

提问by PowerUser

I'm developing a small Access 2003 DB with 2 forms. The user first enters FrmMainand if a record interests them, they can go to FrmDetails(kind of like a 'drill-down' style). This second form allows the user to leave comments, change a few values, etc. and is called with the following code:

我正在开发一个带有 2 个表单的小型 Access 2003 DB。用户首先输入FrmMain,如果他们对记录感兴趣,他们可以转到FrmDetails(有点像“钻取”风格)。第二种形式允许用户发表评论、更改一些值等,并使用以下代码调用:

Private Sub Cmd_GoToDetailsForm_DblClick(Cancel As Integer)
   DoCmd.OpenForm "FrmDetails", , , _
      "[TblF1-Main].[The_ID]=""" & Me.The_ID.Value & """"
End Sub

Here's the problem, the user can't edit any of the fields in FrmDetails. Why not and can you suggest a fix?. More facts about my problem:

问题是,用户无法编辑FrmDetails. 为什么不呢,你能建议修复吗?. 关于我的问题的更多事实:

  • When I open FrmDetailsdirectly, I can edit them without a problem
  • FrmDetailshas no VBA code. It will soon, but not yet.
  • FrmDetails's recordsource is a table with all the default properties.
  • This is the 2nd database I've designed that uses this model. I've compared this broken db with the working db and I don't see any notable differences.
  • 当我FrmDetails直接打开时,我可以毫无问题地编辑它们
  • FrmDetails没有 VBA 代码。很快就会,但还没有。
  • FrmDetails的记录源是一个具有所有默认属性的表。
  • 这是我设计的第二个使用此模型的数据库。我已经将这个损坏的数据库与工作数据库进行了比较,我没有看到任何显着的差异。

回答by PowerUser

Found the answer finally. For no particular reason, I had set FrmMain's Record Lock's property to All Records(The default setting is No Locks). Since both forms were based on the same table, I'm guessing that the 1st Form locked the records for the 2nd form. @mwolfe02, Thanks for your help!

终于找到答案了。没有特别的原因,我已经建立FrmMainRecord Lock的属性All Records(默认设置为No Locks)。由于两个表单都基于同一个表,我猜第一个表单锁定了第二个表单的记录。@mwolfe02,感谢您的帮助!

回答by Kovags

Is FrmDetails being opened as a sub form of FrmMail? If so, check whether the SubForm control is Locked or not.

FrmDetails 是否作为 FrmMail 的子表单打开?如果是,请检查 SubForm 控件是否已锁定。

After that, check whether the form FrmDetails has the property Allow Edits and Allow Additions are set to Yes or No.

之后,检查表单 FrmDetails 是否将允许编辑和允许添加属性设置为是或否。