Picture Attachments How To

runbear

New member
Local time
Today, 07:51
Joined
Apr 16, 2010
Messages
2
User wants to build a database which includes pictures as attachments.

Is there an easy way to buiid the database other then creating a form for them to use and input the pics one at a time?

Input to excel (they would rather) and import?
 
How would you input the pictures in Excel? It's possible to mass-import image files from a folder into an Attachment filed though.
 
If the BE is Jet/ACE, I would NOT recommend storing the pictures in the table directly. A better method is to store them in a folder and store the path as text field. If you want an organized file structure, It would be simplest if the folders are not scattered but grouped under one high level folder. I have a setup like this for one of my apps. The top level is DEA which is the name of the application. Then there is a separate folder for each client. As a new client is added to the database, the app automatically creates this folder based on the unique abbreviation assigned to the client. Then code in a different form creates new folders under the client folder for each employee. Since the path can be derived, the table only holds the actual name of the file.

As to importing/logging names, You can write code to read through all the files in a folder and either import them or log them (better).
 
I'm going to add my voice to Pat's. Never import a picture It bloats the database VERY quickly vs. storing a file path to the picture and just activating it when it is needed.

If you don't want to do this by hand, you need to read up on the FileSystemObject (yes, the name is run together like that for lookup purposes.) With FSO, you can find a folder and scan the names of the files in the folder. You can get the fully qualified file spec from FSO.

To display the file, as Pat said, you could then load the file name to an Image control on a form. The trick will be to associate the picture with a particular person or account. You would have to figure out how to do that if you are trying to support automatic loading. Probably you would need a file naming convention at the very least.
 
In the app I aluded to above, the filenames were EmployeeID_SomeSuffix_SomeDate.extension Most of the files were .jpg but we had .docx, .xlxs,, .pdf, and possibly others also. The important part was the first n caracters to the left of the first underscore were the EmployeeID. Looking up the EmployeeID gave me the way to obtain the folder path names.

The files were handled by a third party service bureau, they received printed documents and scanned them or emails with attachments. They uploaded them to our FTP site an the Access app down loaded them a couple of times a day into a common folder. As part of the import process, it logged the file name and moved the file to the correct folder. If there was an error because a file was named incorrectly, the file was moved to an error folder where a human had to figure out the problem and rename the file. Then when all the files in the bulk mail folder had been processed and moved, the originals were deleted leaving the folder empty for the next download.
 

Users who are viewing this thread

Back
Top Bottom