I am using a GDViewer object named StationImage in an MS Access report. This report prints a series of .jpg images whose paths are stored in the database. On one computer a dataset with 206 images works with all calls to the DisplayFromFile returning 0. On another computer the same dataset, gives a return value of 13 for all calls to DisplayFromFile. Both computers are running Win XP and Access XP, but the computer that works without error has 4GB RAM while the other computer has2GB RAM. However if I just ignore the return value of 13, the report displays and prints OK on the computer with less memory.
Here is the code in the report. (Note that I just change the "If lngRetVal = 0 Then" to "If lngRetVal = 0 Or lngRetVal = 13 Then" in order to ignore the return value of 13.)
- Code: Select all
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error GoTo Err_DisplayImage
Dim strResult As String, strImagePath As String
Dim lngRetVal As Integer
strImagePath = Nz(Me!txtFilePathName)
StationImage.CloseImage
If Nz(strImagePath) = "" Then
strResult = "No image name specified."
Else
lngRetVal = StationImage.DisplayFromFile(strImagePath)
If lngRetVal = 0 Then
strResult = ""
Else
StationImage.Clear
Select Case lngRetVal
Case 3
strResult = "Out of memory."
Case 10
strResult = "Can't find specified image file."
Case 13
strResult = "Unknown image format."
Case 22
strResult = "Unsupported image format."
Case Else
strResult = "Error " & lngRetVal & " while displaying image."
End Select
End If
End If
Exit_DisplayImage:
Me!txtImageNote = strResult
Exit Sub
Err_DisplayImage:
Select Case Err.Number
Case Else ' Some other error.
MsgBox "Unexpected error #" & Err.Number & ": " & Err.Description, vbCritical + vbOKOnly, "Error in Displaying Image"
strResult = "An error occurred displaying image."
Resume Exit_DisplayImage:
End Select
End Sub
