Access 2016中的错误2115

时间:2017-04-25 16:43:08

标签: ms-access ms-access-2013 ms-access-2016

我有一个错误:

  

运行时错误2115

     

为此字段设置为BeforeUpdate或ValidationRule属性的宏或函数阻止Microsoft Access在字段中保存数据。

代码如下,第2行的调试Access中断:

Set rs = db.OpenRecordset("Select * from TransactionsC Where IDClient = '" & Extract & _
                           "' Order by IDTransaction DESC")
Set Me.EditTransactionsC_subform.Form.Recordset = rs
Me.EditTransactionsC_subform.Form.Requery
Set rs1 = db.OpenRecordset("Select Filed, Year, Notes from ClientNotes Where IDClient = '" & _
                            Extract & "' Order by Year DESC")
Set Me.ClientNotes_subform.Form.Recordset = rs1
Me.ClientNotes_subform.Form.Requery

我无法弄清楚错误是什么。

1 个答案:

答案 0 :(得分:0)

无需打开和设置记录集对象变量。

Me.EditTransactionsC_subform.Form.RecordSource = "SELECT * FROM TransactionsC WHERE IDClient = '" & Extract "' ORDER BY IDTransaction DESC;"

但为什么要更改RecordSource属性?建议使用Filter和FilterOn属性,或者DoCmd.FindRecord