Add jpeg images

Elmobram22

Registered User.
Local time
Today, 00:05
Joined
Jul 12, 2013
Messages
165
Hi,

Just wondering on how I would link to jpeg files and have access render them.

No idea on how to do it.

Cheers,

Paul
 
An image is an just an Object and to be dynamic you have associate the Image file with an Unique Identifier from the RecordSet.

The first step is to identity where the images are stored.

Code:
Function GetPictureDir() As String
    GetPictureDir = "C:\Images\"
End Function

An inventory Record has StockID so the image is called StockID.jpg.

The Query supporting the form:

ImageFile = [StockID] & ".jpg"

Then:

Code:
Function GetPicturePath()

    With CodeContextObject
        GetPicturePath = GetPictureDir & .[ImageFile]
    End With
End Function

Code:
Function GetPictureExist()

        If Dir(GetPicturePath) <> Empty Then
            GetPictureExist = -1
        Else
            GetPictureExist = 0
        End If
End Function

Code:
Function GetPicture()

    With CodeContextObject
        If GetPictureExist = True Then
            .[ImageControl].Visible = True
            .[ImageControl].Picture = GetPicturePath
        Else
            .[ImageControl].Visible = False
        End If
    End With
End Function

On the Form Current Event: =GetPicture()

Simon
 

Users who are viewing this thread

Back
Top Bottom