Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-Time Error 3622

Status
Not open for further replies.

daveinchicago

IS-IT--Management
Feb 13, 2012
19
US
If Not (Me.RLCatssubform1.Form.Recordset.EOF And Me.RLCatssubform1.Form.Recordset.BOF) Then
If MsgBox("Are you sure you want to Delete?", vbYesNo) = vbYes Then
CurrentDb.Execute "Delete from dbo_COMPLIANCE_RESTR_CATEG " & _
"where ID=" & Me.RLCatssubform1.Form.Recordset.Fields("ID"), dbFailOnError + dbSeeChanges
Me.RLCatssubform1.Form.Requery
End If
End If


I've got the above code tied to a button in Access 2010. The subform is a SQL Table. When I highlight a row in the subform (SQL Table) and hit the 'delete' button, the row should delete. However, I am getting a
Run-Time error '3622' You must use dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column.

I am clearly using dbSeeChanges so I'm not sure what the problem is. Any help is greatly appreciated.
 
Hi. I changed the code to the following and now working great!!

If Not (Me.RLCatssubform1.Form.Recordset.EOF And Me.RLCatssubform1.Form.Recordset.BOF) Then
If MsgBox("Are you sure you want to Delete?", vbYesNo) = vbYes Then
SQ = "DELETE FROM dbo_COMPLIANCE_RESTR_CATEG WHERE ID = " & Me.RLCatssubform1.Form.Recordset.ID & ";"
DoCmd.SetWarnings (warningsoff)
DoCmd.RunSQL (SQ), dbFailOnError Or dbSeeChanges

Me.RLCatssubform1.Form.Requery
sfJustCats.Form.Requery

End If
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top