Are attachments orphaned if software crashes during the add function

Posted on 2011-04-20
Last Modified: 2013-11-28
I have a database I am developing in MS-Access 2007.  The size is not an issue, I have read the tip on slow response from a database with multiple forms.  I am attaching several text files to the database in an "attachment" field type.  After debugging the code I came to the realization that since I was crashing out of the application are these attachments being orphaned?  If they are orphaned will the "Compact and Rebair Database" function get rid of the orphaned records.  I would assume that when a record is deleted from the database, the appropriate "attachment" field information is also deleted.  But since I am crashing out of the database, I am not properly closing the file.    Does anyone have any thoughts on this?  
Question by:WLoftus
    LVL 47

    Accepted Solution

    This won't be much help, but I recommend against adding attachments to the Access database.  It is far easier to manage storing the attachments to a file server somewhere, and then recording the filepath and name in the database.

    Access databases are relatively limited in their size, and attachments will quickly gobble up the available space.
    LVL 84
    The Attachment datatype has alleviated some of those issues fyed mentions, however I also concur - unless you have a compelling need to store those attachments in the database, then just store the path and use that to work with the item.

    One example where you might use the Attachment field would be if you need to include photos of products for a travelling salesman. It would be dificult to sync up the photos on a file system, and in that case the Attachment datatype might be a good fit.
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    <The Attachment datatype has alleviated some of those issues fyed mentions>

    Scott, are you implying that the attachments are not included in the total database size limits?

    LVL 26

    Expert Comment

    I'll add a third chime to saying that Attachment data types are evil.
    Create a table with an autonumber primary key, a foreign key to the existing table and a text field to store a path.
    Then save out your file to a folder, and put a record in the new table.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    760 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

    11 Experts available now in Live!

    Get 1:1 Help Now