Delete Query - 'Specify the table containing the records you want to delete' (1 Viewer)

Jemmo

Registered User.
Local time
Today, 00:33
Joined
Jul 28, 2008
Messages
82
I have almost finished building a database and the goalposts have moved (don't you just love it when that happens!).

The main piece of work is a load of number crunching and report output and this all works fine.

Now I have been handed a bunch of 'Exceptions' where records meeting the criteria should be reported out (for further analysis elsewhere) and excluded from the reports.

I have a form where the user can input a SupplierId (Cupid) which updates a table. The table is bound to the form. I have done it like this because the Exceptions list may change and the user will need to update it.

I have a query to report out records meeting the Exception criteria, so that takes care of reporting out the Exception records. It's the delete query I am having trouble with.

Put simply, I need to delete records from table1 where the Cupid appears in table2.

The delete query contains two tables (tblOSSMN117, tblExceptions_Cupid)
with a join on Cupid. When I run the query I get 'Specify the table containing the records you want to delete'.

If I edit the query in SQL View to;

DELETE *
FROM tblOSSMN117
WHERE tblOSSMN117.Cupid = tblExceptions_Cupid.Cupid;

I get a parameter pop-up asking for the value of tblExceptions_Cupid_Cupid

Where am I going wrong?
 
Last edited:

redneckgeek

New member
Local time
Yesterday, 19:33
Joined
Dec 28, 2007
Messages
464
Make sure your query doesn't just say DELETE * FROM ....

Change it to DELETE tblOSSMN117.* FROM ...
 

Jemmo

Registered User.
Local time
Today, 00:33
Joined
Jul 28, 2008
Messages
82
Thanks for the quick reply.

I still get the pop-up.
If I OK it without entering a value, it runs but doesn't delete the one record in the table that matches the Cupid in tblExceptions_Cupid.
 

Jemmo

Registered User.
Local time
Today, 00:33
Joined
Jul 28, 2008
Messages
82
I just solved it.

Dopey me!

I was using;

WHERE tblOSSMN117.Cupid = tblExceptions_Cupid.Cupid

and it should have been

WHERE tblOSSMN117.Cupid IN
(SELECT tblExceptions_Cupid.Cupid
FROM tblExceptions_Cupid);
 

Users who are viewing this thread

Top Bottom