Using Docmd.Runcommand to delete form record??

  • Thread starter Thread starter ACastelo
  • Start date Start date
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)
 
Back
Top