I need help from the big boys.. Insert and Resize Photo.

mshelley1

Carbo
Local time
Yesterday, 20:43
Joined
Feb 12, 2006
Messages
45
Insert and Resize Photo.

Access 2000

Problem:

I have a form named “Department Employee” on it is a bound object frame named “Photo”; I am having trouble writing code that will allow me to select a .jpg from a floppy, resize it to 162x216 Pixels and insert it into the bound object frame.

Thanks in advance

Mickey Shelley
 
Last edited:
One of the problems when you insert pictures into a database is the size grows very quickly. This results in reduced performance.

For some time I have been placing photo/graphics into a separate folder. I then link the picture to the table. This keeps the database size under control.

When inserting the photo, select "Zoom" on the Size Mode selection in the Properties. This will adjust the photo to the available space.
 
I agree with your solution to this issue; is it possible however to conduct this process with code? By that I mean can you write code that will remove the picture from the media (floppy), place it in a directory, and link it to the .mdb table? The primary reason being, user friendliness. If so any help with the code will be greatly appreciated.

Bound object frame name: Photo
Form name: Department Employees
Table name: Employee ID
Field Name: PHOTO
 
I'm sure there must be a way to code it, but I don't know what it is.

If the only problem is the photo, set it up as above, save the photos to a separate file on your hard drive, save it and forget it.

How often are the photos updated. I worked at a company for 25 years and they never updated my personnel photo in all that time.
 
Use the CommonDialog control to browse to the image then you can use FileSystemObject in VBA to copy the image from one location to any other local or network folder, and rename the file in the process.

Set fsObj = CreateObject("Scripting.FileSystemObject")
fsObj.CopyFile strImgOrigPath, strNewFile

Store the path or new file name in a table with the key you use in your employee table (or in the same table).
Then in the "On Current" event of your form, retrieve the file path and set the "picture" property of your image control to the image path.

Me.imgEmployee.Picture = strPicturePath
 

Users who are viewing this thread

Back
Top Bottom