Intermittent error with jpg on report

DataMinerHome

Registered User.
Local time
Yesterday, 17:31
Joined
Jan 4, 2010
Messages
57
I have a report which displays images located outside of Access. This is a fairly large report, with and all the images are jpg's. When I print the report, intermittently, some of the jpg's just don't show up. It's different ones each time. When I view the report on screen, when it gets to a certain page, I get the error message "mydb doesn't support the format of the file "mypic.jpg", or the file is too large. Try converting to bmp or gif."

The report currently has 58 pages, each with a picture. When I view the report on screen, at the 22nd page, I start getting the error message "mydb doesn't support the format of the file "mypic.jpg", or the file is too large. Try converting to bmp or gif."

The images for these are still jpg's and are in fact smaller than some of the jpgs in the preceding pages.

In addition, if I open a smaller subset of the report, these pages open fine.

Code is shown below. Access 2003 on Windows XP.
Any ideas? My best idea right now is to set up the report to print, say, 10 pages at a time, close, reopen and print the next 10 pages, etc.


Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

GetPicturesForReport Me.Report

End Sub
Code:
Sub GetPicturesForReport(RPT As Report)

Dim DB As DAO.Database

 On Error GoTo ErrHandle
Set DB = CurrentDb

RPT.Controls("Image1").Visible = True

RPT.Controls("image1").Picture = ImagePath & RPT.Controls("StandID").Value & ".jpg"

GoTo CloseAll

ErrHandle:

Select Case Err.Number

Case 2719 '"a problem occurred while accessing the ole object"

    MsgBox "can't link to " & RS!PictureAddress

Case 2220 'no picture file
RPT.Controls("image1").Visible = False

Case Else

    MsgBox Err.Description

End Select
CloseAll:

Set RS = Nothing

Set DB = Nothing

Set F = Nothing

End Sub
 
Can you attach mypic.jpg

Whatever you do don't use a bitmap - a rubbishbin (a rather large one at that) format

Simon
 
I can't show you the pictures, they are proprietary info. IN any event, it's not the particular picture that's the problem. All pictures work fine as long as I don't include more than about 15 records in the report.
 
Mine are as well all 17,000 of them I've sure I've seen this error before, PM me with an image if you could:

Prior to Access 2007 I used dbpix - now I can use the standard picture using the image control.

I use a functions and then OnLoad on the Detail Section of Report or the OnCurrent on a Form:

I put this Expression into a Query and then onto the Form:

ImageFile = [StandID] & ".jpg"


Code:
Function GetPicturePath()
' Define the image file
    With CodeContextObject
        GetPicturePath = GetPictureDir & .[ImageFile]
    End With
End Function
Code:
Function GetPictureExist()
' Establish if the file exists
        If Dir(GetPicturePath) <> Empty Then
            GetPictureExist = -1
        Else
            GetPictureExist = 0
        End If
End Function
Code:
Function GetPicture()
' This is the function to render the image
    With CodeContextObject
        If GetPictureExist = True Then
            .[ImageControl].Visible = True
            .[ImageControl].Picture = GetPicturePath
        Else
            .[ImageControl].Visible = False
        End If
    End With
End Function

Simon
 

Users who are viewing this thread

Back
Top Bottom