Could not delete from specified tables. (Error 3086)

I have a delete query that works as select query, but will errors when 
changed to a delete query.  As part of the query I have the table I am 
deleting the records from as well as a query limits to records to be deleted. 
 The main table contains invoice attributes with a multi-field primary key 
(invoice number & revenue category).  The query may list multiple invoice 
numbers, but always unique.  So the relationship is always many to one.  I 
ran into a similar situation with update queries, but once I converted the 
limiting query into a Make Table Query and used the results of the new table 
in the Update Query it worked.  I tried converting my limit query to a Make 
Table Query and use the results, but I received the same error.  Below is the 
SQL code for the query in case it helps, but I have to warn I have no 
training in SQL, and I usually only use when given advise. 

DELETE [tblRA - Invoices by Revenue Category].*
FROM [tblRA - Invoices by Revenue Category] RIGHT JOIN [tblRR - Arrangement 
Adjustment Clear TEMP] ON [tblRA - Invoices by Revenue 
Category].InvoiceNumber = [tblRR - Arrangement Adjustment Clear 

1/4/2008 1:21:01 AM
access 16762 articles. 2 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 8

On Thu, 3 Jan 2008 17:21:01 -0800, mikeycan
<> wrote:

>I have a delete query that works as select query, but will errors when 
>changed to a delete query. 

Why the right join? That will - if the query works at all - delete all the
records in your table!

If you want to delete only those records in  
[tblRA - Invoices by Revenue Category] which exist in 
[tblRR - Arrangement Adjustment Clear TEMP] try

DELETE [tblRA - Invoices by Revenue Category].*
FROM [tblRA - Invoices by Revenue Category] INNER JOIN [tblRR - Arrangement 
Adjustment Clear TEMP] ON [tblRA - Invoices by Revenue 
Category].InvoiceNumber = [tblRR - Arrangement Adjustment Clear 

This will work only if there is a unique index on InvoiceNumber. An
alternative is to use an IN clause:

DELETE [tblRA - Invoices by Revenue Category].*
FROM [tblRA - Invoices by Revenue Category] 
WHERE InvoiceNumber IN
 (SELECT InvoiceNumber FROM
 [tblRR - Arrangement Adjustment Clear TEMP] );

Back everything up first of course!!!

             John W. Vinson [MVP]
1/4/2008 3:16:09 AM

Similar Artilces:

Error 8004000
I am constantly getting "Error 8004000" Line 40 Char1 expected statement with my script and can't figure out why. 'Logging Option Explicit 'Declarations Const LOGFILE = "c:\SysAd Tools\Logs\UA.log" Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 'Open and write to the end of log Dim ComputerName Dim oFSO Dim strComputer Dim strComputerName Const HKEY_LOCAL_MACHINE = &H80000002 Dim WshShell Dim oReg Dim strKeyPath Dim subkey Dim arrSubKeys strComputer = "." Set oFSO = CreateObject("Scripting.FIleSyst...

Pivot Table row comparison
I'm trying to compare an old customer schedule with their new schedule and highlight the changes with colour or by hiding a row. My pivot table looks like this Prod Sched wk1 wk2 wk3 A old 3 2 3 A new 3 4 3 B old 2 2 2 B new 2 2 2 So in the above example I'd like to colour the cells for wk2- Product A in yellow, and hide the product B rows as there has been no change in demand. Can someone give me some advice about how to do this Thanks for your help Ross How about an alternative??? Your raw data looks kind of like this: Prod Sched wk# qty...

How to Recover Deleted Sent Mail?
While trying to delete very old "Sent" mail I seem to have deleted all "Sent" mail. Is there a way of recovering this mail? Have you closed Outlook since deleting the old sent mail? might help. Next time, archive the items you want removed from your active .pst file. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, Sidney Friedman as...

Getting an error in my xml schema editor code.
Hi, I have an xsd file like this. <xsd:schema xmlns:xsd="" xmlns="generic" elementFormDefault="qualified" targetNamespace="generic"> <xsd:element name="bookstore" type="bookstoreType"/> <xsd:complexType name="bookstoreType"> <xsd:sequence maxOccurs="unbounded"> <xsd:element name="book" type="bookType"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="bookType&q...

Cannot delete subreport
I am using Access 2003 and have a report I did a while back with a simple subreport. I want to remove the subreport but for the life of me can't figure out how to do it. Any help would be greatly appreciated. Thanks. Hi - When you say "remove the sub report", what do you mean? Do you want to delete the entire subreport control containing the subreport, or do you want to keep the control, but change the report contained in it? The first is easy - select the control by clicking once on it once, then press delete. For the second, click the control once, then set ...

Item wise balance in Pivot Table
I want to get item wise balance in Pivot Table, I tried to enter formula in pivot table and it works but whenever the new item insert it does not show and I have to copy formula for each item, can anyone help me Thanks in Advance Abdul Samad ...

Rule for Deleted Items
I am being told that there is a rule in place on my Exchange server that will not empty the deleted items folder every 30 days for certain users in my organization. I found a recipient policy in System Manager that says "Users Excluded from Mailbox Cleanup" but it only shows 2 users and not the 3 I was told about. But I have confirmed that the missing person has email in her deleted items folder going back to 2005 so it must be working. Is there any other location I should be looking? Also, we just had someone come in and migrate our Exchange environment from 2000 to a new...

pulling table modified date
hey all, i'm trying to set the value of a text box on my form to the Created Date of a table in my database. its not the recordsource of the form. any ideas? TIA Ted also I forgot to mention the table is in a different database "Ted" <> wrote in message news:uLzIPc$ZIHA.1184@TK2MSFTNGP04.phx.gbl... > hey all, i'm trying to set the value of a text box on my form to the > Created Date of a table in my database. its not the recordsource of the > form. any ideas? > > TIA > Ted > > > You could get the creatio...

cannot delete message from deleted items
I have a message in my deleted items folder that when choosing delete opens the McAfee box warning of potential virus and wants me to choose open or do not open, but will not delete. I have tried choosing another file and holding ctrl and choosing the file I want deleted and then choosing delete, I have tried moving it to the desktop but it will only copy there, I have tried every form of delete possible. I need help. Anyone know how? Outlook 2002. Can you empty the deleted items folder entirely? Or turn off the McAfee scanning temporarily to see if it makes a difference? Julie wr...

Manipulating Pivot Table Data Fields
Hi all, Have a question regarding the Data Field in pivot tables. I have a number of rows that have repeating values. What I want in the Data Field (Sum) is a count of DISTINCT values in the column. ie: FR065817 \ FR065817 |----> counted as one FR065817 / FR066154 \___> counted as one FR066154 / FR066158 -----> counted as one FR066159 \___> counted as one FR066159 / However I need all the data in the table as I'm using other columns for different fields in the pivot table. Is there a way to do this? If I have to split the table somehow, I'm willing to do...

how can I export data by VBA and specify type of delimitor
I want to export data from excel by VBA and specify to use ',' as delimitor. but I can only export a file rename to .csv. but when I open it, it still a excel file, but not a text file. How can I do it? Million thanks. You could (temporarily???) change your windows list separator: Windows start button|Settings|control panel regional and language Settings Options applet. regional Options tab|customize button List separator near the bottom of the dialog. Or you could use a macro. You could borrow some code from one of these sites: Chip Pearson's:

I can not delete a duplicate personal folders list #2
Vall... amazing that there isn't an easy fix for this. The instructions provided simply don't work ( tools-email accounts-view change email accounts-deliver to new account-finish-close outlook and reopen ), and none of the other offered explanations have worked either. As this is such a common problem; why hasn't microsoft provided a very EASY fix? I am more confused ( and frightened ) and don't want to make the problem worse! Your profile is corrupt, probably based on an incorrect migration of your ..pst file. Create a new mail profile and configure it to use your exi...

Retrieval of Deleted Items After Being Deleted from the Deleted Items File
I deleted a number of important emails from the deleted items file in Outlook 2000. This may sound stupid, but I completely emptied the deleted items file instead of deleting them one by one. Pretty stupid, huh. Anyone. Can they be retrieved? Please help. Thanks. Sorry for sending this again but I seem to be computer illiterate and it has taken me some time to explain the whole situation. Thanks again. unless you use Exchange server with deleted retention enabled, you are most likely out of luck, but you can try something that might help....

Unknow dictionary error
Monday morn Last night I copied the server's "shared documents" folder to another disk in the server. And shared it as "Shared Documents." This morning, from the GP's client computer, the "Unkown Dictionary" error message is display when attempting to log in. I moved the MSBS folder back to the original location, shared the original "Shared Documents" folder as "Shared Documents" and provided sharing permissions. The security permissions had not changed. I have rebooted the client machine. Still the error is displayed. Guidan...

Exchange Restore Error
I'm in the process of performing some disaster recovery testing and I've run into a problem with restoring our site's Exchange 2003 servers. I first restored the system Windows 2003 Server server, and then the Exchange Server storage groups, ensuring the "Last Restore Set" and "Mount Database After Restore" options were checked. The NTBackup portion of the Exchange restore completed without errors, but the mailbox and public folder stores won't mount. The Event Log reports a "ESE BACKUP event 903" error with the text "Information Sto...

Refreshing fields in table cells.
Situation is as follows ... A document header contains a text box. This text box contains a table. The table has a field in each cell (20 fields in total). How do I select all these fields in VBA to refresh their values? The text box (and the table therein) are in a building block that is placed in the header using a macro. I know the cells can refresh because I see the refreshed values if I do a print preview, but I want to see them while looking at page Layout just after I have defined new field values. Field values are applied via a user form and it also here after pressing...

RPC Error in Outlook 2003
I am encountering an RPC error as I try to connect to my exchange server. When I try to resolve my name I get a timeout error and when I try to open outlook I get the RPC error. Could you provide a solution? Without telling us the exact error, the only guess I can come up with is you are missing one of the following registry keys. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\ClientProtocols "ncacn_np"="rpcrt4.dll" "ncacn_ip_tcp"="rpcrt4.dll" "ncadg_ip_udp"="rpcrt4.dll" "ncacn_http"="rpcrt4.dll" -- Due to the Sw...

Delete macros
I am using Excel 2002. When I click on Tools->Macro->Macros... i see 2 macros. The problem I am having is that I can't delete these macros, the delete button to the right is grayed out. How can I delete these macros? Hi maybe the macros are protected. Try hitting ALT + F11 to open the VBA editor and try to delete the macros / modules there -- Regards Frank Kabel Frankfurt, Germany excel777 wrote: > I am using Excel 2002. When I click on Tools->Macro->Macros... i see > 2 macros. The problem I am having is that I can't delete these > macros, the delete button to ...

deleting email in outlook, freezes before i can delete
i have a file with pics that symetec scanner says is to large. i can receieve email but cannot send any. it freezes before i can delete and says non responding. Hi All, I want to re-raise the old issue of Fax numbers showing up in the Outlook Address book when one is sending an email. I know that this can be stopped by prepending the Contact's fax number with a letter so that Outlook doesn't see it as a valid fax number and therefore doesn't list it. What's always puzzled me, however, is that this fix doesn't work if the fax numbers are changed using an export to CSV...

make table not replacing table on back end
Access 2003 I have split my database and distributed the FE to users The database has an ODBC connection to Lotus Notes. I create a make table query called q00NonconformMKTbl to dump the data from the Lotus Notes ODBC connection to the tNonconformance table. But since the database is split when i run the Make table it is only updating on my instance of the FE. Is there a why to do a Make table and specify to delete and recreate the table in the BE? It was making me crazy until i figured why only my db was updating with lates data. -- deb Instead of dropping a tab...

OK to delete Deleted Items folder?
I'm afraid I'll have to delete my Deleted Items folder in Outlook 2000. When I try to empty the folder I get a "The messaging interfce has returned an unknown error. If the problem persists Restart Outlook" message. Is it possible to delete the entire folder and replace it with an empty new one? Will it create any problems? TIA Henrik Not possible. Run scanpst.exe against your pst-file to scan it for errors first. -- Robert Sparnaaij [MVP-Outlook] Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Se...

Run time Error '1004
I have a macro to run right before the workbook closes. It is as follows: Private Sub Workbook_BeforeClose(Cancel As Boolean) Range("A1").Select ActiveSheet.ShowAllData ActiveWorkbook.Save End Sub The top row has the autofilter on. If the data is not filtered then when the macro runs it throws a Run Time Error '1004'. If it is filtered the Macro runs fine. I can't seems to find the right code to get the macro to end if it errors out. I think it would be an if then statement but my coding skills aren't quite up the par. Any help would be great. Thanks in adva...

How to delete chart
I created a histogram and want to delete it. I select it and the faint double border apperars. There are no square handles like in 2003. Then I press the Delete key. The faint double border goes away replaced by a single thin black border. The chart is still there and is not able to be selected at all. I entered "delete chart" in the Excel Help window, and there was nothing at all on deleting a chart. Ditto for "remove chart." I got no help searching on the internet either. I have Excel 2007 and Windows XP Professional When the border changes, can you press Delete a...

error on save with Access 2002
Access cannot save changes to dependant OLE object. (Direct translation of the Spanish error message) When trying to save record that has a field linked to a .pdf file. It works on Access 2K and not for Access 2K2 users Translation of error message continues: You have no permissions to write to log where object is stored or log is locked by another user Any idea how to fix this? ...

cannot group dates in pivot table
I have imported data form an access database into excel. This data includes dates and events. I have put the dates into the row section of a pivot table and want to group the dates by 10 years. When I right click on the date field and choose group I get the message 'cannot group that selection'. Can anybody tell me where I am going wrong please? I am using Excel and access 2002 ...