Solved

Access Attachement Field: Record won't save

Posted on 2013-11-25
3
264 Views
Last Modified: 2013-12-01
I have a single table with names and addresses.  I have a simple for that allows me to add new records and to save them.  This all worked until I added an Attachment field to the table.  I can add attachments to existing records.  I can add records to the table.  BUT when I add a new record to the table via the Form (I can see the record is there, the autonumber populates), when I try to save the record via me.requery or acCmdSaveRecord, the record is lost.  If I remove the Attachment field from the table, then the form works again.

What am I missing?  Many thanks for your wisdom.
0
Comment
Question by:4GvnNot4Gotn
  • 2
3 Comments
 
LVL 21
ID: 39675193
It would help to now the version of Access including SP level?

If Access 2007, make sure you have the Office SP2 update installed.

Do you have any VBA code in the form's Before Insert event?

FWIW: I contumely run into issues with the Attachment data type. I find it best to avoid them.
0
 

Author Comment

by:4GvnNot4Gotn
ID: 39678130
I am getting the same results on both my Access 2007 and Access 2013 machines.  Both machines have all the Office updates installed.

There is no code in the BeforeInsert, only code in the AfterInsert.  In the AfterInsert I refresh a listbox so the user can see the record added.

Very strange.  A friend says he always puts attachment fields in a joined table.  You have to use a subform to view the data but by keeping the attachment field separate from the parent record, he says you can avoid a number of issues.  Without a better solution I may try that.
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 39679411
I do lots of document management tasks in Access. I attach files to records a lot. I use a separate table also. Each record has a single file path. I store the full path as text. Hyperlinks are a lot harder to work with. By using just plain text to store the path this method also works well with other database type as the back end. I have been able to use it with server different  SQL Servers.

I have created this example:
Document Links 2 (Click Here)
This is an update to the basic example of how to store the path to a file and also be able to view the file. You can browse using the standards windows common dialog to select the file. You can view the file using the application defined with the Windows File Associations. It uses the ShelExec API to open the file. It does not use the .Followhyperlink  method.

This example is a continuous form that could easily be used as a sub form to attach multiple documents to a record.

***** Because it doesn't use the hyperlink data type, this new version stores the path in a way that allows the folder to be easily moved.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a nutshell Dropbox is a cloud-based data storage service which synchronizes with data files on your computers. The Dropbox folk provide 2GB of free storage but if you need more you can sign up for a 50GB or 100GB subscription account. I pr…
Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

713 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