Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Attachments to forms 1

Status
Not open for further replies.

Yardyy

Technical User
Aug 13, 2002
448
GB
Hi, Is it possible to attach files to a record, ie, we have a requirement whereby a person wants to add say a pdf or jpg file to a clients record, is this possible, if so how would i go about achieving it.



Many Thanks
Yurov Ardyy
 
What I do is provide a table that contains a field of hyperlinks. Then the user can copy and paste the Windows address of the file or folder into the field in the database, and it's linked. Prevents you from having to store the file itself and bloating your table, and accomplishes the same thing.
 
Using a blob field in an Access database to store a file such as a JPG, PDF or DOC is going to increase the size of your database quite substantially.
With the file size limit of 2Gb for an MDB file this could be reached quite quickly if you have a lot of records.

A better way is to store the path to a file in a text field, then actually save them in a network shared folder so all the database contains is a field in a table containing something like \\Server\MyApp\Files\Somefile.txt
You then have a button that uses ShellExecute to open the file with whatever the default app is to handle that particular file format.

John
 
Both sound very good, i wasnt aware of the 2GB limit, thanks.. how would i go about storing the hyperlinks to a text field, got to make this as easy as possible. I like the idea of a network share, so when the user next time goes to the record and clicks the attachment the file should open in the default application.. sounds good

Many Thanks
Yurov Ardyy
 
To clarify - the 2Gb limit is for Access 2000/2003, not sure about 2007.
If you're still on Access 97, the file size limit is 1Gb.

John
 
Hi, jbarnett how would i go about acieving this

"A better way is to store the path to a file in a text field, then actually save them in a network shared folder so all the database contains is a field in a table containing something like \\Server\MyApp\Files\Somefile.txt
You then have a button that uses ShellExecute to open the file with whatever the default app is to handle that particular file format."

sounds like this would suffice for my situation.

Many Thanks
Yurov Ardyy
 
FollowHyperlink PathToFile

Is sufficient to open a file with its registered application.
 
Add a text field to your table to indicate the path to that file.
Add a textbox on any forms bound to this field.

You can then populate this field with the paths to the files as necessary.

As Remou says, using FollowHyperlink is an easier way than using ShellExecute to open a registered file with its application.

John
 
sounds good, i will give this a go, and report back thanks chaps..

Many Thanks
Yurov Ardyy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top