ms access delete query with attachment

Posted on 2012-08-12
Last Modified: 2013-03-27
I have a table that has a field that has attachements.  I tried to run a delete query to remove some records but got a message:

"An Update or Delete query cannot contain a multi-valued field"

Any suggestions on how to delete these records?

Question by:johnmadigan
    LVL 13

    Expert Comment

    Can you post your total query? Can you also post the result of the subquery? You can try to use LIMIT 1 in the subquery. Then he'll give 1 result.

    But we can do a check-up if you provide us the query, etc..

    Author Comment

    Here is the sql for the delete query:

    DELETE [Purchase Requests].Date_of_Request, [Purchase Requests].Status, [Purchase Requests].ID, [Purchase Requests].Date_Needed, [Purchase Requests].Remarks_Instructions, [Purchase Requests].Preferred_Supplier, [Purchase Requests].Cost_Center, [Purchase Requests].Job_Number, [Purchase Requests].Ship_To, [Purchase Requests].Quote_or_Invoice_Number, [Purchase Requests].HMPCO_Attn_To, [Purchase Requests].Ship_Method, [Purchase Requests].Order_Date, [Purchase Requests].Arrival_Date, [Purchase Requests].Inv_Cont_Purch_Remarks, [Purchase Requests].PO_Number, [Purchase Requests].Requestor, [Purchase Requests].Approved_By, [Purchase Requests].User_Names, [Purchase Requests].Date_Approved, [Purchase Requests].Lock, [Purchase Requests].Attachment, [Purchase Requests].[5S+1], [Purchase Requests].JobRel
    FROM [Purchase Requests]
    WHERE ((([Purchase Requests].Date_of_Request)<#6/30/2012#) AND (([Purchase Requests].Status)="CLOSED"));

    the problem is that the Attachement field can have multiple attachements so when I try a simple delete query it does not like it.

    Not sure how I can delete the records.
    LVL 13

    Accepted Solution

    You can create a loop. That deletes the rows  in the attachement table. Afterwards you can execute your query.
    LVL 9

    Assisted Solution

    If you want to delete the records, don't specify the fields to delete.


    FROM [Purchase Requests]
    WHERE ((([Purchase Requests].Date_of_Request)<#6/30/2012#) AND (([Purchase Requests].Status)="CLOSED"));

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
    Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now