Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004

    Unanswered: Can't open image in report (Runtime Error 2220)

    Hi all,
    I've done some searching around the forums and found this problem, however everyone seems to figure out the problem and not post it or it is something I'm not dealing with. Anyway, I have an image control in a report and I need to load a picture based on the record. I'm using this code in the form and it works like a dream:

    RecipeDir = CurrentDBDir()
    If IsNull(Picture1.Value) Then
    strPic1 = RecipeDir & "images\NoPicture.jpg"
    strPic1 = RecipeDir & "images\" & Picture1.Value
    End If
    strRecipe1 = strPic1
    imgPicture1.Picture = strPic1

    I have my pictures in an "images" directory within the DB directory. This works great within the form, but when I do this in the Report Details "OnPrint", It gives me the Runtime Error 2220: MS Access can't open the file "G:\Recipes\images\NoPicture.jpg" however the picture is out there. Am I missing something? Like I said, it works fine in the form. Thanks all in advance!
    Last edited by NeAlvey; 12-03-04 at 23:37.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    I'm not sure but I think "imgPicture1.Picture = strPic1" wont always work. Inserting the code into the 'on print event' is probably to late - should be in the "on format" event.
    Have you defined a bound image on the report?. Failing that I'd try assigning the image path in the "on format" event. You will need toselect the correct property of the image object. you cant just assign a path to the object as I think the default property of the image object is the image itself (ie the raw data)
    As a side note:-
    Bear in mind an image that looks good on screen will look pretty poor on print (as a general rule you need to reduce the size (scale) of the image by at least a third and preferably more [screen res is approx 70 pixels, printer res is 330,600,1200 or even 2400 dots per inch]).

Posting Permissions

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