Tuesday, 6 July 2010

Putting photos in access records

So, I'm doing the staff photo boards for the whole college, and being as it is so large I'm going to be efficient and use a database. The first step of creating a database and putting all people in it, with the time and date of every photo taken down, so we know which photo is for which person.

Embedding the photos is not practical because apparently it converts them to bmp files which takes up a lot of disk space. So linking is the way to go. It means I'll have to have a folder for each photo shoot, which is always next to the database.

I found a nice little article which looks very simples. http://bytes.com/topic/access/answers/189710-linked-pictures. Basically, drag the photo into the field, then if you want to display it in a form you put:

on your form, create an Image object, and in Form_Current() place something like: Me![ImageFrame].Picture = Me![fImagePath]

2 hours later....

Tried this on a test database and it was a success. Wasn't quite sure what he meant by "image object" or "Form_Current" and the rest of it, so with a little bit of trial and error I succeeded! So here's what to do:

  1. Make a text field in the table where you put the location of the picture - i.e. c:\pictures\my picture.jpg
  2. Next make a report based on the table. I used the wizard, added the fields I wanted and went into design view.
  3. In the Detail section (middle bit) is where the data gets displayed. Along with the description, I put an "Image Box" found in the Controls section in the toolbars.
  4. It will want you to specify an image, just click "cancel"
  5. Click on the image container and on the right, you want to edit the "Control Source"
  6. I think I just selected the field with the photo location data in. Although I do remember putting:
    1. Me![ImageFrame].Picture = Me![Photo Location] - but I'm not entirely sure? Photo Location was the field I created in the table

Just got to work out how to tile it horizontally and vertically on a page.

Also, by default it "zooms" the image, so that it fits inside the box (no stretching). If you click on the image and set the format "Size Mode" to clip, it crops the image!! Yes!       - No!, on second thoughts it puts the image up at the size the image specifies if you go on zoom and crops almost all the large images. So I put it on zoom and put no border and seethrough background. Just have to make sure all the images are the same size.

No comments:

Post a Comment