Multiple record deletion using checkbox?

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
 
D

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)
 
F

fredg

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.
 

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

Similar Threads


Top