Delete selected records with a button in Datasheet view

M

Mario A.

I have a form called frmProducts with a subform on it called subProducts.

The subform is in datasheet view.

I have a 'Delete' button on my form which when pressed I want the SELECTED
records in the subform deleted.

The subform has it's RecordSelectors visible - this is how the user can
select mutliple records.

In the button click event I have:

subProducts.SetFocus
DoCmd.RunCommand acCmdDeleteRows


The problem is that as soon as the user Clicks the 'Delete' button the focus
moves from the subform which causes the selection of records in the subform
to change. The selection changes to become only the current record.

Is there a way to stop this behaviour?

Currently the only way the user can delete a range of records is by right
mouse clicking on the selection to bring up the 'context sensitive' menu
(also know as pop-up menu) and selecting delete from here. Obviously such
menus do not cause a change of focus to occur.

The use of context sensitive menus is far from intuitive for most users
however - so this is far from idea as a solution.

Just clicking a button is much better.
 
T

tina

how about telling your users to highlight the records they want to delete in
the subform, and then pressing the Delete key on the keyboard? that should
be pretty easy for them to remember.

hth
 
R

Ron2006

Initiate the suggestion from Tina
and maybe change the button to a label that says:

To delete: select records and press delete key.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top