i changed my code to use SQL delete which works (when there are no child records), however the requery goes right to the error routine displays "Record is deleted". Which I know and want to display the query window with the newly updated recordset.
Here is my code:
Private Sub cmdDeleteRecords_Click()
On Error GoTo deleteRecordsError
Set db = CurrentDb()
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenDynaset)
Stop
db.Execute "delete * from JB_Jobs where JB_Deletesw = true and JB_JoborBid = false"
Requery
GoTo endofsub
deleteRecordsError:
MsgBox "deleteRecordsError: " & Err.Description & " - " & Err.Number
endofsub:
End Sub
Here is my code:
Private Sub cmdDeleteRecords_Click()
On Error GoTo deleteRecordsError
Set db = CurrentDb()
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenDynaset)
Stop
db.Execute "delete * from JB_Jobs where JB_Deletesw = true and JB_JoborBid = false"
Requery
GoTo endofsub
deleteRecordsError:
MsgBox "deleteRecordsError: " & Err.Description & " - " & Err.Number
endofsub:
End Sub