docmd.accmddeleterecord not working

  • Thread starter Thread starter JimS
  • Start date Start date
J

JimS

I've tried this several ways, but I can't seem to get this to work. It's
simple. I want to delete the "child" records, then the "Parent" records. The
part that deletes the "Child" records (A2007, Referential Integrity set)
works fine all the time. The deletion of the "Parent" record fails whenever
there are no "Child" records.

I tried using a recordsetclone to delete the current record, and then this,
but none works. AllowDeletions is set to true.
-----code follows:
Dim rst As DAO.Recordset
Set rst = Me.sfmFBoMDetail.Form.RecordsetClone
rst.MoveFirst
While Not rst.EOF
rst.Delete
rst.MoveNext
Wend
Set rst = Nothing

DoCmd.RunCommand acCmdDeleteRecord

-- end of code


Jim
 
Seem to have gotten it to work...

Added a me.refresh after the Set rst...
Added a me.requery after the DoCmd.Run.....
 
Why use a recordset to do the deletion?

It's far more efficient simply to run a Delete query.
 
Back
Top