Delete on Continuous form gives error 2046

  • Thread starter Corey-g via AccessMonster.com
  • Start date
C

Corey-g via AccessMonster.com

Hi All,

I have hunted the newsgroup and tried many different things, but I still
can't seem to get this right...

I have a main form for entering in order information, and a sub form for
adding in the items ordered. The subform default view is set to 'Continuous
Forms', Allow Additions/Deletions/Edits are all true.
the data entry property is false if that makes any difference.

I have put a button (btnRemoveItem) into the details section of this subform -
and have tried to write the code to have the current record deleted when the
button is pressed. The code I used that gives this error is:

DoCmd.RunCommand acCmdDeleteRecord

I have also been working with the recordset clone of the form - but I had
issues there too. It would delete the first time, but I couldn't seem to get
the recordset working right...

Dim rsTemp As DAO.Recordset

set rsTemp = me.recordetclone
' Tried to use bookmark, absoluteposition, currentrecord here
' to make sure I'm on the right record but not working right
rsTemp.delete

And the form's Record Source is currently just the table, but I will change
it to a query once I get this part to work correctly....

Any help would be greatly appreciated.

Corey
 
C

Corey-g via AccessMonster.com

Ok, I was way overthinking it... I simplified and voila - it worked.
So to clarify what I did / versus what was wrong:

In the click event

Dim rstemp as DAO.recordset
Set rstemp = me.recordsetclone
rstemp.bookmark = me.bookmark
rstemp.delete
rstemp.close
set rstemp = nothing

Small, easy, KISS (Keep It Simple Stupid) :)

Sorry if I wasted anyones time...

Corey
 

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