Delete Query based on result of select query

J

John Finch

Hi there,

I am going round in circles here and hope that someone can
give me some help.

I have a select query that finds 18 records (with a
primary key made up of four fields) - I then want to
delete these 18 records from a table.

I tried creating a delete query based on the table and
using dlookup in the criterier of the four fields but this
only results in one record being deleted.

I then tried creating a select query linking the previous
query and the table I wished to delete from by linking on
the four fields. As a select the query showed me all 18
records but as soon as I changed the query type to delete
and run it I get "specify the table containing the records
you want to delete".

Is it going to be possible to do what I am trying to do
using query alone or will I need to write some sql?

looking forward to any help you can offer.

with kind regards

John Finch
 
T

Ted Allen

Hi John,

My guess is that when you changed the select query to a
delete query you may not have specified which table you
want to delete the records from.

When you changed your select query to a delete query, a
new line in the query builder should have appeared
(labeled "delete:") which allows you to specify which
table you want to delete records from. In one column you
should select the table.* that you want to delete from,
and then select FROM on the delete line. For any
additional columns in the query, the setting should be
WHERE, to specify your criteria.

HTH, Ted Allen
 

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