Results 1 to 6 of 6
  1. #1
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904

    Dynamic/Variable Image File on Report

    I created an interactive Access program for our users. Basically, it creates Reports for mailing. It combines a bunch of data from a SQL database with a bunch of inputs the users make (i.e. dates, names, etc). It works pretty well, but I would like to add one more thing to it.



    Here is what I would like to do. Basically, each person is going to give me an "electronic" version of their signature (really, just an image file). One of the fields that the user inputs is "signer name". What I would love to do is make this report dynamic, so based on whatever "signer name" they pick, it automatically puts that signaure on the report. So, the image on the report itself would be variable.

    I am not sure how to do that. Maybe something like if the name signature on the report was a link to an image file on our network, and that link is dynamic based on what they enter for "signer name".

    Is this possible?

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Although I have many questions regarding how you actually store "persons" Information in your database but my suggestion would:

    1) You need to store the "signature" file path of each of the persons signature linked to the person data e.g. C:\Signature_folder\maximus.jpg.
    2) Then create a Image object e.g. Image0 in your report
    3) On On Format Event of your report you need to add this code:

    Me.Image0.picture=Path of the signature
    Me.Image0.Requery


    Well I have very little information to work with here and I don't know how you maintain data but the signature file path should be properly referenced to its owners. if you need further help feel free to post again.

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Maximus,

    Thanks for the reply. Yes, they will be stored as jpg files somewhere on our network. I can easily create a cross-link table tying each signee's name to the appropriate signature link, and incorporate this into the query I am using as the data source of my report.

    I started to mess around with this, but I cannot seem to get it to work. First, there does not seem to be any "On Format" event on Access Reports. I tried the "On Current" event, but could not get it to work. Since I am putting this image in the Detail section of my report, I also tried putting it in the "On Format" event of the Detail section. That did not work either.

    I tried different variations of the code. This is the original code I tried:
    Code:
        Me.Image11.Picture = Me.ImageName
        Me.Image11.Requery
    where "ImageName" is the full path and name of where the image file resides on the network.

    I then tried copying the image file to my hard-drive, and accessing it directly, like this:
    Code:
        Me.Image11.Picture = "C:\C\calvin.jpg"
        Me.Image11.Requery
    Finally, I went in to the properties of the Image file, and hard-coded in "C:\C\calvin.jpg" into the "Picture" property. That is the only thing that did work. Of course, that is not dynamic.

    Any ideas on what I may be doing wrong?

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    OK. Upon further testing, it DOES work if I put it in the "On Format" event of the Detail section. The key is that you only see it in Print Preview or when you Print it. It does not show in Report View.

    That's fine with me!

  5. #5
    maximus's Avatar
    maximus is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2009
    Location
    India
    Posts
    931

    Image File on Report

    Here is a screen shot of how to get to the OnFormat even which can be found in the properties of the Details section of the Access Report refer to screen shot:

    and a small piece of code to demonstrate how to dynamically change the picture displayed in an image control.

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If IsNull(Me.photo_info_path) Then
        Me.Image56.Picture = "D:\Photographs\Resources\no-photo.jpg"
    Else
        If Dir(Me.photo_info_path) <> "" Then
        Me.Image56.Picture = Me.photo_info_path
        Me.Image56.Requery
        Else
        Me.Image56.Picture = "D:\Photographs\Resources\no-photo.jpg"
        End If
    End If
    End Sub

    JoeM Glad you figured out well. The trick is to open your report in the Print Preview mode. Well this piece of code here is an example.

    Code:
    DoCmd.OpenReport strDocname, acViewPreview, , strCriteria
    Attached Thumbnails Attached Thumbnails onFormatEvent.png  

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I found the "On Format" event. From your original reply, it looked like you were saying it was on the Properties of the Report itself. As I mentioned, I found it under the Detail section of the Report, and then things worked out.

    Thanks again for your assistance. It is working great!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Image display in reports from external file
    By lumoco in forum Reports
    Replies: 2
    Last Post: 09-28-2011, 04:37 PM
  2. Replies: 0
    Last Post: 12-03-2010, 02:17 PM
  3. Replies: 1
    Last Post: 09-27-2010, 10:10 AM
  4. Image with its file name !!!!!
    By ahai in forum Access
    Replies: 0
    Last Post: 07-17-2007, 02:39 AM
  5. The file name with the image
    By ahai in forum Forms
    Replies: 0
    Last Post: 07-16-2007, 01:41 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