docmd.accmddeleterecord not working

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
 
J

JimS

Seem to have gotten it to work...

Added a me.refresh after the Set rst...
Added a me.requery after the DoCmd.Run.....
 
D

Douglas J. Steele

Why use a recordset to do the deletion?

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top