Solved

Access Attachement Field: Record won't save

Posted on 2013-11-25
3
224 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

To stay competitive, modern businesses must adapt and stay innovative, and this is increasingly only possible by working with outside talent. Managers and executives have understood the power of outsourcing for quite some time, but traditional clien…
Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

771 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