Using Docmd.Runcommand to delete form record??

A

ACastelo

I have a form that basically loads a table. Most of the fields are
displayed.
I provided a few buttons for the user to scroll backward and forward on
the records. However, I also created a "Delete Record" button.

I used the followign code to do this:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

I do use a custom menu toolbar for this form. I use the same one for the
other form, and it works fine. So i'm kind a lost here..

(I know that this cmd is replaced by docmd.runcommand, but I used the
above code that exisisted in an old aplication and it worked fine for
one form. But now I have problems. I also don't understand it very well.
All I know is that it simulates entering the Edit menu..)

I did this for two different forms. On one form it deletes it fine(it
uses sql). But in the other form where the table name is provided as the
data source. It gives me an error, and it won't delete it. It gives me
the Error Msg "The command or action 'Refresh' isn't available now." Any
idea what this means?

Or any other quick way fo doing this deletion ? - thanks !!!

Thanks for your help,
(e-mail address removed)
 

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