Is there anyone who has a better idea on how to code displaying images faster in a report? The images are stored in a separate folder and only the path of those image files are stored in the database as text. We have been able to display the images but the displaying of images is quite slow. I think it's loading the whole set of pictures files first before it displays in the report.
Any feedbacks or tips will be appreciated.
Currently, the code we have done goes like this:
Option Compare Database
Option Explicit
Dim SQLQuery As String
Dim varPhotoPath As String
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim varFilePath As String
varFilePath = varPhotoPath & Me.PHOTO_PATH
If Len(Dir(varFilePath)) Then
Report_PHOTO_OFFER.ImagePho.Picture = varFilePath
Else: Report_PHOTO_OFFER.ImagePho.Picture = varPhotoPath & "blank.jpg"
End If
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim dynX As Recordset
SQLQuery = "select photo_path from photo_path"
Set dynX = CurrentDb.OpenRecordset(SQLQuery, dbOpenDynaset)
If dynX.RecordCount > 0 Then
varPhotoPath = dynX!PHOTO_PATH
Else: varPhotoPath = ""
End If
dynX.Close
Set dynX = Nothing
End Sub
Any feedbacks or tips will be appreciated.
Currently, the code we have done goes like this:
Option Compare Database
Option Explicit
Dim SQLQuery As String
Dim varPhotoPath As String
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim varFilePath As String
varFilePath = varPhotoPath & Me.PHOTO_PATH
If Len(Dir(varFilePath)) Then
Report_PHOTO_OFFER.ImagePho.Picture = varFilePath
Else: Report_PHOTO_OFFER.ImagePho.Picture = varPhotoPath & "blank.jpg"
End If
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim dynX As Recordset
SQLQuery = "select photo_path from photo_path"
Set dynX = CurrentDb.OpenRecordset(SQLQuery, dbOpenDynaset)
If dynX.RecordCount > 0 Then
varPhotoPath = dynX!PHOTO_PATH
Else: varPhotoPath = ""
End If
dynX.Close
Set dynX = Nothing
End Sub