Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2002
    Posts
    5

    Question Unanswered: External images in report ??

    Hey

    I have a database that I have just extracted all the OLE images from.
    They are all in a folder called ' pictures '

    There is already a report which has a image box on it, but it will only display the image if it is stored in the table.

    I have tried the following and different variations,
    "f:\db\picture\" & ID number & ".jpeg"
    but nothing seemes to work


    Any ideas please?

  2. #2
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    147
    Assuming you've stored the URL of the image in the table then you can do the following:

    1) Add a textbox to the report linked to the field containing the URL of the image. Make this control hidden, and call it something like txtImage_URL.

    2) Create an Image Control (Unbound), call it something like ctrThe_Image

    3) In the OnPrint event of the DETAIL section add the following code:
    Code:
    If Not IsNull(Me![txtImage_URL]) Then
        Me![ctrThe_Image].Picture = Me![txtImage_URL]
    End If
    That should be it!

    Cheers,
    Andrew
    Last edited by Bunce; 07-16-02 at 06:40.
    There have been many posts made throughout the world.
    This was one of them.

  3. #3
    Join Date
    Jul 2002
    Posts
    5
    excelent!

    thanks ive got it sorted now!

  4. #4
    Join Date
    Apr 2004
    Location
    Victoria BC, Canada
    Posts
    6

    Report linking to folder of images

    I have a Personnel database. I also have a folder of people's pictures which have been named according to the person's ID. In a REPORT, I've set the following:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    Me.ImageFrame.Picture = "N:\databases\pers\perspics\" & Me.PersID & ".jpg"

    End Sub

    This works great if there is a picture for everyone. However, if someone on the report doesn't have a corresponding picture, it results in runtime error '2220' and won't open the report.

    I'd like No_Pic.jpg to be displayed if there is no corresponding image. I know I could add a checkbox field to my table such as "HasPic" and use an if statement (if haspic = true then path, else no_pic.jpg), but I REALLY would rather avoid that extra step of checking off all those boxes as new pictures get added.

    I tried setting On Error Goto... so that if an error came up, it would use the path to No_Pic.jpg instead, but then it displays No_Pic.jpg for ALL the people on the report, even if they had a picture.

    Help!

  5. #5
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    Set fs = CreateObject("Scripting.FileSystemObject")
    dim strPath as string

    strPath="N:\databases\pers\perspics\"
    strPath=strPath & Me.PersID
    strPath=strPath & ".jpg"

    if not fs.FileExists(strPath) then
    strPath="N:\databases\pers\perspics\No_Pic.jpg"
    end if
    me.ImageFrame.Picture=strPath

    HTH

  6. #6
    Join Date
    Apr 2004
    Location
    Victoria BC, Canada
    Posts
    6
    That works well, thanks for the quick response!

    It's a bit annoying how the error window flashes for a few seconds when the report first loads, as it formats all the pictures. Any way around that?

  7. #7
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    If you are confident there will be no errors, just add
    on error resume next

    as the first line of code

  8. #8
    Join Date
    Apr 2004
    Location
    Victoria BC, Canada
    Posts
    6
    Oooops, my bad.
    My weary eyes thought it was the error message that was flickering on my screen, but it turns out it's the "Importing image" dialog that is coming up as it processes each picture. It takes a while to go through all our staff so it flickers there for about a minute.

  9. #9
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    no problem, If you find a way to speed it up and get rid of the flickering, please let me know. I have a db that loads +-5600 images, and it takes forever to format the report for print preview/print...

  10. #10
    Join Date
    Apr 2004
    Location
    Victoria BC, Canada
    Posts
    6
    I wish I knew how to put up a progress bar that stays up until the report is done formatting. Ideally it would cover up (or replace) the flickering 'importing image' one.

    I'll let you know if I find a way to speed things up. Thanks again for your help!

  11. #11
    Join Date
    Nov 2012
    Posts
    6
    hello all
    i have a personaly database and in that place i have some external pictures for one personal , i want to have a report based on a query , question is how can i show more linked pictures on a report for one it is fine .
    my code for one picture is :
    Private Sub Report_Load()
    On Error GoTo Err_Report_Load

    If Dir(Me!txtPicture) = "" Then
    Me!DocPicture.Picture = ""
    Else
    Me!DocPicture.Picture = Me!txtPicture
    End If

    Exit_Report_Load:
    Exit Sub

    Err_Report_Load:
    MsgBox Err.Description
    Resume Exit_Report_Load
    End Sub

    thanks
    khajeh

  12. #12
    Join Date
    Nov 2012
    Posts
    6
    hi all
    i found my answer thanks

    I did assign the picture source control to Me!txtPicture
    it automaticaly Ok in continous form or report

    thanks for your late
    LOL

Posting Permissions

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