Full Version: delete record - no current record
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
cbwarren
I am using a command button to delete current record. In production version, no menu will be availble.
If I am on the record in my form, use the "edit" menu diretly and delete it works, so does clicking "no" on the subsequent warning messge.

In my coded version (see end), if I click "no" on the warning message box, I get a "run time error3021 no current record". Here is my code:

----------------------
Private Sub Command38_Click()
'What: delete current record on form
'
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.Requery
End Sub
-----------------------------

thanks in advance.
jhardy66
Change your code to the following and see if it does what you need:

CODE


Private Sub Command38_Click()

    'What: delete current record on form



    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVe r70



End Sub
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.