Home
dbPix
Download
Order
Testimonials
Support
Tutorials
Samples
KnowledgeBase
Links
Revision History
Documentation
Search
Contact
Site Map

Graph: dbPix image storage vs OLE Embedding and Linking in Microsoft Access


DBPix Sample Source Code: rptImages
Back to sample
Option Compare Database
Option Explicit

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim strPhotoRelativePath As String
    Dim strFullPhotoPath As String

    ' Make sure that the report has some records
    If Me.HasData Then
        ' Get the relative path from the table, handling null values
        strPhotoRelativePath = Nz(Me![PhotoPath], "")

        ' Check that the relative path is not empty
        If Len(strPhotoRelativePath) > 0 Then
            ' Prepend the relative path with BASE_PATH, to create an absolute path
            strFullPhotoPath = BASE_PATH + strPhotoRelativePath
            
            ' Check that the file exists
            If Len(Dir(strFullPhotoPath)) > 0 Then
                ' Display the image and exit
                Me!DBPixCtrl.ImageViewFile strFullPhotoPath
                Exit Sub
            End If
        End If
    End If
    
    ' If we reach here one of the previous conditions was not satisfied - clear the control
    Me!DBPixCtrl.ImageViewBlob Null
End Sub

Back to sample