Delete Qry Problem

J

Jennifer

I have read the other posts about delete query problems, and none of them are
helping me.
Here is my SQL stmt:
DELETE [CB FE Cumulative tbl].APCRE_RSN_CDE, [CB FE Cumulative
tbl].Description, [CB FE Cumulative tbl].SumOfAPGLD_INVC_AMT, [CB FE
Cumulative tbl].FY, [CB FE Cumulative tbl].PD, [CB FE Cumulative tbl].FYPD
FROM [Select FY-PD] INNER JOIN [CB FE Cumulative tbl] ON [Select FY-PD].FYPD
= [CB FE Cumulative tbl].FYPD;

I am trying to delete all row data from my CB FE Cumulative tbl, where the
FYPD (in CB FE Cumulative tbl) is the same as the Select FY-PD tbl. Here is
what I've tried:
1. DELETE FROM [CB FE Cumulative tbl] WHERE ([CB FE Cumulative].FYPD
=[Select FY-PD].FYPD)

Any suggestions would be greatly appreciated.

Thanks,
Jennifer
 
J

John Spencer MVP

STEP 1: BACKUP your data before attempting the following.
STEP 2: BACKUP your data before attempting the following.

Without a backup you cannot restore the data if this does not work the way you
expect.

DELETE
FROM [CB FE Cumulative tbl]
WHERE [CB FE Cumulative tbl].FYPD IN
(SELECT [Select FY-PD].FYPD
FROM [Select FY-PD].FYPD)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
K

Ken Snell MVP

Slight typo in John's query:

DELETE
FROM [CB FE Cumulative tbl]
WHERE [CB FE Cumulative tbl].FYPD IN
(SELECT [Select FY-PD].FYPD
FROM [Select FY-PD])

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


John Spencer MVP said:
STEP 1: BACKUP your data before attempting the following.
STEP 2: BACKUP your data before attempting the following.

Without a backup you cannot restore the data if this does not work the way
you expect.

DELETE
FROM [CB FE Cumulative tbl]
WHERE [CB FE Cumulative tbl].FYPD IN
(SELECT [Select FY-PD].FYPD
FROM [Select FY-PD].FYPD)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I have read the other posts about delete query problems, and none of them
are helping me. Here is my SQL stmt: DELETE [CB FE Cumulative
tbl].APCRE_RSN_CDE, [CB FE Cumulative tbl].Description, [CB FE Cumulative
tbl].SumOfAPGLD_INVC_AMT, [CB FE Cumulative tbl].FY, [CB FE Cumulative
tbl].PD, [CB FE Cumulative tbl].FYPD
FROM [Select FY-PD] INNER JOIN [CB FE Cumulative tbl] ON [Select
FY-PD].FYPD = [CB FE Cumulative tbl].FYPD;

I am trying to delete all row data from my CB FE Cumulative tbl, where
the FYPD (in CB FE Cumulative tbl) is the same as the Select FY-PD tbl.
Here is what I've tried:
1. DELETE FROM [CB FE Cumulative tbl] WHERE ([CB FE Cumulative].FYPD
=[Select FY-PD].FYPD)

Any suggestions would be greatly appreciated. Thanks,
Jennifer
 
J

John Spencer MVP

Whoops! Thanks for the backup and correction.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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