Results 1 to 15 of 15

Thread: Images in reports (Access)

  1. #1

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478

    Images in reports (Access)

    Hi there.

    Does someone know how to manipulate the reports in access.

    I am trying to add a picture to the details section of a report.
    This works for 50 %.

    How can I supress the details section if no picture is available ??
    This doesn't work if i set it in the details section ;


    How can them picture sizes be manipulated during runtime ??

    The first could be have the size of the third .


    Someone know how to do this stuff ?
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  2. #2
    Lively Member
    Join Date
    Oct 2002
    Posts
    112
    Working off memory here so please forgive me if I'm wrong but I assume your using the image control if so set the image mode to stretch rather than clip and it will automaticaly fit the size you have set the control to.

    As for the hide the detail section I'm not sure if testing the image control source on opening the report and if it was null, set the detail visible property to false would work or not I guess you would have to try it and see.

    HTH

    JFK

  3. #3

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    Not quite my question.
    I'll rephrase.

    The pictures are called at runtime so the stretch isn't working like it should.

    The details section has more than these pictures to show.
    If for some data a picture is not available i'd set the visible property for the image to false , but this doesn't surpress the sections height.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  4. #4
    Lively Member
    Join Date
    Oct 2002
    Posts
    112
    I understand better now I can't help you with the image problem I'm afraid but is the rest of the data a fixed height so that if an image isn't available then you can set the detail height property to a known value?

    If not I can't remember if the reports have a can grow and can shrink property as forms do ,if you set both of these to yes then the section will fit itself to the contents.

    HTH

    JFK

  5. #5

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    The height cannot be set in the print event, if i place it in the format event nothing happens. section stays same .

    If i set the visible property to false it is set for each record.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  6. #6
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    Try using a third label with a function attached to it that activates on every record. if the picture is empty size it to 0.

  7. #7

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    I've managed to set the height in the detail format section.

    Does someone know how i can get the width and height of them images , these are not available in a DB but are stored on the machine local or not.

    I would like to set the sizes to these images at runtime.
    This to not waste space or shrink images in a smaller size.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  8. #8

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    No one knows how to get the sizes of images on machine.

    They can be in any format, bmp, jpg, ...
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  9. #9
    Katuil
    Guest
    Let me see if I remember how to do this.

    First you need a image control in the report section. Next in the code for the format of the detail section of the report you need to add a check to see if there's an image to load. If no image then set the visible property for the report section that has the image control to false.

    Second, once you know that you have an image you need to set the properties from code, not on the image control. The control is just the conduit to display the image. This means that you can set the strech property and any pther value fopr the image control in code on the format section of the detail section of the report. This will work for any type of image of any size.

    Let me know if this helps, if not then send me an example of your report and I can work out a method that will do what you need. I have done this before several ways.

  10. #10

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    This is what i got till now
    VB Code:
    1. Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
    2. 'ive got foto control which holds the link to the image
    3.    Me![foto].Properties("Height") = 0
    4.    Me![img].Picture = ""
    5.    Me![img].Visible = False
    6.    If IsNull([foto]) Then
    7.       Me![img].Properties("Height") = 0
    8.    'if the foto property is empty i set the heights of the image and section to 0
    9.       Me.Detail1.Height = 0
    10.    Else
    11.       ' else i set a default height for the image cause i don't know
    12.       'the sizes of these images
    13.          Me![img].Properties("Height") = 1255
    14.          Me![img].Picture = Mid([foto], 2, Len([foto]) - 2)
    15.          Me![img].Visible = True
    16.          Me![img].Properties("SizeMode") = 0
    17.    End If
    18. End Sub
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  11. #11
    Lively Member
    Join Date
    Oct 2002
    Posts
    112
    Swatty how about

    Me![img].sizetofit = true


    JFK

  12. #12

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    Thanks man how about

    VB Code:
    1. err.description
    2. You entered an expression that has an invalid reference to the property SizeToFit.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  13. #13
    Katuil
    Guest
    Let me see what I come up with. I know that I have done this before. May take a few days for me to find it or write it.

  14. #14
    Katuil
    Guest

    Thumbs up Answer

    Sorry took so long, had to start from the begining. Let me know if this wirks for you. Be sure to use images that you have on your pc and not the ones that I have referenced in the table.

  15. #15
    Katuil
    Guest
    Did not realize that the file is too large to upload so we will need to work it out another way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width