Multiple record deletion using checkbox?

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hopefully there is a very simple answer to this, so here goes.

I have a table full of suppliers and have created a form which lists the
supplier name and a check box next to each, on a continuous form - the check
box is called "GroupDelete" - what I would like to do is to select as many
records as I want, then click a command button which will delete all of them
in one go - at the moment, I can only delete them one by one

Thanks in advance

Daniel
 
Thanks Steve - worked great

Daniel

Steve said:
Create a query based on your suppliers table. You only need to include the
checkbox field. Set the criteria of the checkbox field to True. Change the
query to a Delete query. Put a button on your form and put the following
code in the Click event:
DoCmd.RunCommand acSave
DoCmd.OpenQuery "NameOfYourDeleteQuery"

When you click the button, you will delete all the suppliers you checked.

Steve
(e-mail address removed)
 
Hopefully there is a very simple answer to this, so here goes.

I have a table full of suppliers and have created a form which lists the
supplier name and a check box next to each, on a continuous form - the check
box is called "GroupDelete" - what I would like to do is to select as many
records as I want, then click a command button which will delete all of them
in one go - at the moment, I can only delete them one by one

Thanks in advance

Daniel

As the Click event of the command button, code (all on one line):

CurrentDb.Execute "Delete TableName.* from TableName Where
TableName.[GroupDelete] = -1",dbFailOnError

Only records in which the check box has bee selected will be deleted.
You will not be able to delete a Supplier if that Supplier is used in
a related table.
 
Back
Top