problem with deletes.

  • Thread starter Thread starter vchell
  • Start date Start date
V

vchell

Guest
Hello,!

I have a stand-alone form with one table as its source with no referential integrity issues. I am using Access 2000 version.

I used the commands
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

to delete a record, and it does nothing, no error message, but does not delete either.

I found the help site

http://support.microsoft.com/default.aspx?scid=kb;en-us;182435

They mentioned it sa for Access 97, but I thought it relates to what I was facing. I took off the Modal and Pop-up properties back to 'No'. Still the same problem. Then I substituted the above 2 commands with
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

But now I get the error message

The command or action 'DeleteRecord' isn't available now..

Have you seen this before? Any help is greatly appreciated.

Vchell.
 
Are you using a button to delete records?

If so, create the button again and use the wizard, that'll do the code for you and work. Ive not had any problems before by doing that.

An axample of mine: OnClick
Code:
Private Sub DeleteRecord2_Click()
On Error GoTo Err_DeleteRecord2_Click


    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_DeleteRecord2_Click:
    Exit Sub

Err_DeleteRecord2_Click:
    MsgBox Err.Description, vbInformation, "Conflict Error!"
    Resume Exit_DeleteRecord2_Click
    
End Sub
 
Last edited:
Code:
 DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

The above code is obsolete, instead use

Code:
Private Sub DeleteItem_Click()
On Error GoTo Err_DeleteItem_Click
DoCmd.SetWarnings False
If MsgBox("Are you sure you want to delete the current item ?", vbYesNo, "Warning ...") = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
DoCmd.SetWarnings True
End If
Exit_DeleteItem_Click:
Exit Sub
Err_DeleteItem_Click:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_Err_DeleteItem_Click
End Sub
 
The command or action 'DeleteRecord' isn't available now..
That error means that there are no selected records so Access does not know what records you want deleted.
 

Users who are viewing this thread

Back
Top Bottom