deleting from a form- default code doesnt work? (1 Viewer)

shrndegruv

Registered User.
Local time
Yesterday, 16:11
Joined
Sep 8, 2004
Messages
58
Hey all

Ive made a form with a drop down menu and a button -- the user selects a record and then clicks the button to delete. I created the button and a wizard appeared, so I selected the delete record option. Whenever I try to delete a record, I get a beep, and nothing happens. No confirm box appears. The verticle bar on the left of the form lights up, but clicking on it does nothing. Any ideas?

Here is the event code access generated...

Code:
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click


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

Exit_Command9_Click:
    Exit Sub

Err_Command9_Click:
    MsgBox Err.Description
    Resume Exit_Command9_Click
    
End Sub
 
Local time
Yesterday, 16:11
Joined
Aug 2, 2004
Messages
272
Allow Deletions ?

Put the form in design view. Make sure that Allow Deletions is set to yes. If it is set to Yes, set it to No, save the form, set it back to Yes, and save it again.

Or, change the DoMenuItem to

Application.RunCommand acCmdDeleteRecord

You may get a response from other 'experts' telling you that the DoMenuItem functionality is Obsolete, etc, yadda, yadda, yadda - which it clearly is not since MS still uses it in its wizards.

It is true that is is mainly there for backward compatibility, but if it works, I say use it. :p

HTH :cool:
 
Last edited:

Users who are viewing this thread

Top Bottom