Connecting Tech Pros Worldwide Forums | Help | Site Map

Delete Query

Newbie
 
Join Date: Aug 2007
Location: New Zealand
Posts: 12
#1: Sep 4 '07
I'm uploading data from a table that I need to refresh from time to time. I need to basically delete all of the data & then I repopulate again with fresh data.

I can't seem to get the query to work using either of these query options:

Expand|Select|Wrap|Line Numbers
  1. DELETE * FROM CPL_A3_BASIC_MAT_VIEW;
  2. DELETE * FROM CPL_A3_BASIC_MAT_VIEW WHERE CPL_A3_BASIC_MAT_VIEW.[Material Type]="HIBE";
The error message I receive is Single-row update/delete affected more than one row of a linked table. Unique index contains duplicate values.
The table itself resides on another machine cennected via OBDC. I can update with ease, just can't seem to delete???

Newbie
 
Join Date: Aug 2007
Location: New Zealand
Posts: 12
#2: Sep 5 '07

re: Delete Query


**BUMP*** anyone have any ideas what the error message above means??

Cheers, Stevo
Scott Price's Avatar
Moderator
 
Join Date: Jul 2007
Location: Seattle, WA
Posts: 1,314
#3: Sep 5 '07

re: Delete Query


Quote:

Originally Posted by StevoNZ

**BUMP*** anyone have any ideas what the error message above means??

Cheers, Stevo

Two things to try:

Have a look-see on how you're linking to the fields in the backend. For instance if you are opening the table through the .OpenRecordSet method there is a setting called dpAppendOnly that will allow additions, but no deletions. If you have all permissions, try changing the syntax of your delete query:
Expand|Select|Wrap|Line Numbers
  1. DELETE [CPL_A3_BASIC_MAT_VIEW].* FROM [CPL_A3_BASIC_MAT_VIEW] WHERE [CPL_A3_BASIC_MAT_VIEW].[Material Type]="HIBE";
Regards,
Scott
Newbie
 
Join Date: Dec 2007
Posts: 1
#4: Dec 30 '07

re: Delete Query


When I hit this error message the problem turned out to be exactly as described in the error message: Single-row update/delete affected more than one row of a linked table. Unique index contains duplicate values.

This was because of a mismatch between the underlying definition of the table in MySQL and the (out of date) definition in MS Access. What Access thought was the 'unique index' was not, in fact.

The solution was to relink the table in Access using the Linked Table Manager.

Hope this helps someone!
Reply