Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Brecon, South Wales, UK
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report prints filename not picture (2002)

    I must be doing something wrong, but I can't find it.... Help, please!

    I want to print a small picture in each detail line of a report. The picture is to be selected depending on the type of line. So I created a small table of types with a field defined as OLE Object. I inserted the data by using Insert Object and pointing at my graphic files. The table then shows 'Package' in the field. In my report I created a Bound Object control sourced to the table field. However, when I go to Print, or Print Preview, the control shows the filename of the graphic, not the graphic itself. I seem to have tried everything, but I cannot get the picture to print. The picture files themselves are fine and if I insert an image control bound to the picture it displays correctly.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Report prints filename not picture (2002)

    The easy way to do this is to store the path to the graphic file in the table rather than trying to store the image itself. Then use an image control in the report instead of a bound object control. All the code you should need in the report is something like this:

    <pre>Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.imgGraphic.Picture = Me.ImgTextPath
    End Sub</pre>


    Where imgGraphic is the name of the image control on the report and ImgTextPath is the name of the field in the report's recordsource that holds the path pointing to the graphic file.

    In your case, it might be easiest to base the report on a query and "calculate" the path to the image you want to display for each record. then you could use simple code such as the above to make it happen.
    Charlotte

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Brecon, South Wales, UK
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report prints filename not picture (2002)

    Thanks, Charlotte --just the ticket. I will have many hundreds of detail records in the report, but only about 9 types, for each of which I want to have a tiny graphic. If speed is a problem, I may experiment with placing 9 invisible image controls, each permanently set to the relevant picture, and using code in Detail_Format to make the relevant one visible.

  4. #4
    Lounger
    Join Date
    Jan 2001
    Location
    Brecon, South Wales, UK
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report prints filename not picture (2002)

    ...in case it might be of interest to anyone...

    Further to the image controls on detail records problem: after experimenting, it does indeed turn out to be far faster to superimpose 9 invisible image controls each referencing the appropriate picture (.gif file) for the 9 different record types for which I require icons. I then use code in the Detail_Format event to make the relevant image visible. The reason it is faster is that when you declare the picture file for an image control, the actual file is stored with the image control. But when you change the picture, the image file you reference has to be retrieved.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Report prints filename not picture (2002)

    That's workable with only nine images. If you had a lot more, you would probably find the situation reversed.
    Charlotte

Posting Permissions

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