Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    55

    Adding photos to reports

    Hi guys

    I have a database with hundreds of records in a table .My aim was to have a photo for every record but keep the photos in a file not in the database.
    Using a form to chose the item to view .I created a field in the table called photo, i created the query and the report and then added an image box in the report and in the properties changed the control source to the field photo in the table but I still don't get the image on the report .Any ideas where I'm going wrong ? or is there a better way to do this?
    Thanks for reading

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by chr1stoper1 View Post
    ... photos in a file not in the database.
    You do not want to store photos in the database? I prefer to store files on a server, in a folder. I do this whenever possible.

    Quote Originally Posted by chr1stoper1 View Post
    the control source to the field photo in the table
    What is a field photo? If the photo is stored as an attachment, you can use the attachment control. How this approach works around your needs for your Report, I am unsure.

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    Add an Image control to the report. (named 'ImageName' in this example)

    After you add and save the image control, delete it's picture property.

    Code the Detail Section On Format event (if the picture is in the detail section): Me!ImageName.Picture = Me![FieldName]

    ..... in this example 'FieldName' refers to the field in the table/record source that holds the valid path to the image.





  4. #4
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    55
    Hi I did try to do as you suggested but it wont link for some reason

  5. #5
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    I think my code is out of date. Doesn't work for me either in Win 10 and Office 2013 - though it definitely use to in older versions....

    Try this:

    Add an Image control to the report. (named 'ImageName' in this example)

    After you add and save the image control, delete it's picture property.

    Remove all the code the Detail Section On Format event (if the picture is in the detail section) that you may have put in there before.

    Now in the Control Source of ImageName - use the drop down to select the field with the path [FieldName]

    ..... in this example 'FieldName' refers to the field in the table/record source that holds the valid path to the image.

    this is working for me



  6. #6
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    55
    Hi
    Thanks for your reply
    Forgive my ignorance but I don't understand the highlighted part .Where is the detail section?
    Remove all the code the Detail Section On Format event (
    if the pictureis in the detail section) that you may have put in there before.




  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by chr1stoper1 View Post
    ...
    Where is the detail section?
    You mentioned that you added a picture control to a Report. Reports have different sections. For instance, Report Header, Page Footer, Detail Section, Group Header. Where did you place your control?

    You need to place some VBA code in the appropriate On Format event of the appropriate section. Each section has a name. You can use the default name produced by access when the section is created. Each section name will have an On Format event. You will need to assign code to the Picture property of your control and do so in the correct Event handler. Anyway, I believe it is the picture property. As mentioned by NTC, newer versions of Access have added a couple properties to the control. But, I believe you still assign the path to the Picture property.

  8. #8
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    55
    Thanks for the reply .Yes I understand now and yes the image is added in the detail section and I followed all your instructions but it is still not showing up when the report is opened .

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    There is not enough information provided to offer advice on how to troubleshoot your problem. For instance, I have a picture file that is stored on a server separate from my database and I am having trouble with the proper syntax for the file path. - OR - I have pictures stored in my DB as attachment type and they are not displaying in my Report when I use the Attachment Control. - OR - My pictures that are stored on a server display just fine in my form when I use the Image Control, but do not display when I use the Image control in my Report.

  10. #10
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    No vba is needed any more. My original post gave vba instructions based on older architecture circa 2000-2003. Now the image control has a control source. So look at my second post instructions. Just remove the default image picture property (this is put in as part of the wizard when you put it on the report it has you find & select an image). Then the Control Source property will be blank - just use the selector to select the field of the report's record source that contains the path.

  11. #11
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    55
    Ok this is how I have set it up so far. I have a table with anid field,a field called photopath and several other fields containing otherinfoy. All data types are short text. I have a query that has a prompt box that opens and asks for a “tool number”. Whenthe “tool number” is entered into the box it opens a report.
    On the report is the “tool number “ and other informationfrom other fields. The field photo path returns the actual path for example C:\photos\1.jpeg. If I then add an image box tothe report and cancel the prompt to insert a picture. Then open the propertiesfor the image box it is as follows visableyes, picture type embedded ,picture (none).
    In the data tab the control source is photopath.
    In the report properties on event on currentthe code:image1.picture = photopath
    Returns no image

  12. #12
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    Delete your image control on your report and re-do it. This time allow the wizard to complete by selecting an image rather than canceling the prompt. Once the image control is all set up - it should provide a fixed unchanging image. Then go into report design view again, and in the image control's properties now remove the Picture value and at the same time change the blank Control Source to your field.

    there should be no code in any event.

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    @NTC
    I believe the image control was not performing as desired. And started down the OLE path. Then, the OLE did not perform as desired. Hence, the padding suggestion.

  14. #14
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    55
    Hi Guys
    Thanks for your help with this . I have tried what you suggested. I let the wizard save a picture .Then ran the report and it was the same photo for every report ran which I expected. Then in design view in the images properties added the photopath in the control source and ran it again and the original photo the wizard saved still came up . I then went into the image properties again and in the all tab is as follows .image1,control source- photopath,visable -yes
    phototype -embedded Then under this is picture and in there it was the original path the wizard saved . If I delete it no image appears. if I don't delete I get the same original photo the wizard saved?

  15. #15
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I have to apologize because I was confusing two different threads regarding an image.

    As NTC suggested, add an Image control to your report's Detail section. I realize you have tried this already. When you do it, you want to select the control from Design View and from the Controls Group within the Ribbon. This is opposed to using the "Add Existing Fields" found on the Right side of the ribbon.

    Select the Image control and then click the design surface of your report.

    You want to click the appropriate area/group of your report. Perhaps the Detail section is what you desire. When you add the Image Control, cancel the wizard.

    Now, go to the properties of your new Image Control and look at the Data Tab of the Property Sheet. Choose the correct field name for your Image Control's Control Source property.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 08-26-2016, 11:51 AM
  2. Adding new reports to an existing report
    By Rick_S in forum Access
    Replies: 33
    Last Post: 01-30-2016, 04:54 AM
  3. Replies: 1
    Last Post: 01-18-2016, 03:30 PM
  4. Adding 1500 photos!
    By boundfree in forum Access
    Replies: 1
    Last Post: 10-31-2011, 06:44 AM
  5. Adding Running Balance from Form to Reports
    By KIDGEO3 in forum Reports
    Replies: 1
    Last Post: 01-18-2006, 08:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums