Using right click delete to delete records from a form.

Raymas

Registered User.
Local time
Today, 15:12
Joined
Mar 8, 2011
Messages
21
Hi all,

This is an unusual question. Currently on most of the forms in my database I allow the user to delete records by selecting records in a list box on the form and pressing a delete button, I have also allowed them to use the key "Delete" to achieve this.
However, now my manager has asked whether it would be possible to add a delete by right clicking on the record in the list box and selecting the delete option, as this would be an intuitive option. Is this possible? Or wishful thinking?

Cheers,

Raymas
 
Tell to manager, to don't complicate.
 
It's certainly possible, but not trivial. The short version (and I haven't made one in a while, so I'm probably forgetting something):

1) Create a public function that does what you want. It can refer to the form directly or you can probably use ActiveForm and ActiveControl to use it from multiple places.

2) Create a custom Shortcut Menu and call your function in the On Action property.

3) Put that menu in the Shortcut Menu Bar property of the appropriate control(s).

That should replace the default right-click menu with yours.
 
actually, one problem with enabled deletes, is that there is no tidyup "afterdelete" event.

so i often disable deletes, and add a code delete button, that lets me tidyup afterwards. As paul says, you can add a shortcut menu to do this.

Shortcut menus are certainly fiddly until you get the hang of them.


I was thinking about records on a form. Deleting an item from within a list box, is definitely trickier. Personally I dont think it is an intuitive thing to want to do.
 
I have a Quick Tutorial on how to add your own shortcut menu (it is for 2003 and prior though so if it is needed for 2007 or later I haven't yet gotten around to creating a tutorial on that as for that one you need to create macros to do it since the toolbar isn't around anymore to use):
http://www.btabdevelopment.com/ts/shcutmenu
 
If "training" users to use the right click for delete, just remember one little thing. Sometimes it is necessary to disable the drop-down menus in the headers of datashet view of a from, and that can be accomplished by disabling the right-click shortcut menu in the property sheet of the form.
 

Users who are viewing this thread

Back
Top Bottom