Search code examples
ms-accessms-access-2013ms-access-2016

Error 2115 in Access 2016


I have an error:

Run-time error 2115

The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field.

The code is as follows, and Access breaks for debug on line 2:

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

I can't figure out what the error is.


Solution

  • No need to open and set recordset object variables.

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

    But why change RecordSource property? Recommend using Filter and FilterOn properties instead or DoCmd.FindRecord.