Image Control

Yes they are applicable in 03.

The new feature in 07 is a new field type called attachment. It allows the user to attach multiple files to records with zero bloat. If you are not using 07, just ignore for now.
 
Handling images is really easy.

Step 1 - Path Declare in VB
Step 2 - Image File (Form based)

Step 1:

Code:
Function GetImageDir() As String
    GetImageDir = Wherever/it/happens/2b/
End Function

Step 2

Code:
Function GetPicture()
Dim FullPath As String
    With CodeContextObject
        FullPath = GetImageDir & .[Image File]
        If Dir([FullPath]) <> Empty Then
            .[ImageControl].Visible = True
            .[ImageControl].Picture = FullPath
        Else
            .[ImageControl].Visible = False
        End If
    End With
End Function

The reason I set the Path is that implementations of the database may differ, development, web facing or networked.

Get Picture displays an image if it exists or sets the control to invisible if it doesn't.

Not a DLookup to be found!

Simon
 
Handling images is really easy....

THANK you Simon for this, I'm going your way. However, my question was can I have an entire separate table just for image path (text)....how would I then link/display into main table?

thank you in advance :)
 
I would put the variables that determine what image to use in the Query behind the form and concatenate these variables into the Image File wherever it is needed.

Create a control called Image File or whatever you want to call it onto the Form and on the Form itself On Current call GetPicture

Simon
 
Thank Simon, how would do that. Sorry, am pass deadline and my mind is blank.
 
Made a Query for the Form. I don't know how you determine which Image to use but I asume there is a reference within the data.

In a Query I have:

Image File: [Orig Old Stock] & ".jpg"

There is a control on the form called Image file and the Function concatenates the Path and [Image File] to retrieve the image.

There is nothing really clever handling images, its quite simple.

I'm going sailing now and I check how you are going later.

Simon
 
OK Simon,

So here's table i did;
tblImage
-----------
ImageID
ImagePath
ImageName

I then went on to create the query as you suggest: SELECT tblImage.ImageID, [ImagePath]+[ImageName] & ".jpg" AS FotoPic FROM tblImage; so, how do move from here?? :mad:

Thank Samia
 
How do you chose which image to use i.e. what is the correlation to the imageID?


Simon
 
Simon,

Its just the ID and filename.

Samia
 

Users who are viewing this thread

Back
Top Bottom