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: frmZoom
Back to sample
Option Compare Database
Option Explicit

Private Sub Form_Current()
    ' When moving to a different/new record, update the DBPix Control to display the image
    UpdateImage
End Sub


Private Sub UpdateImage()
    Dim strPhotoRelativePath As String
    Dim strFullPhotoPath As String

    ' 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
    
    ' If we reach here one of the previous conditions was not satisfied - clear the control
    Me!DBPixCtrl.ImageViewBlob Null
End Sub

Back to sample