Drive Path for inserting Picture

P

Peter

We manage to insert the photos for Employee (JPG Files) on our database.
However, is it possible for end users to insert the photos by themselves
(i.e. giving them the choice of the location and drive that they can insert
the JPG file) ?

We are using Access 97 but cannot find out how to do so. Is there any
suggestion ?
 
D

Dennis

Try this code behind the click event of a button (ImageBox is the name of the
Image place holder where you insert your picture)

Dim dlgOpen As FileDialog
Dim strFile As String

Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
With dlgOpen
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "JPEG Images", "*.jpg", 1
.Show
End With
If dlgOpen.SelectedItems.Count = 1 Then
strFile = dlgOpen.SelectedItems(1)
ImageBox.SourceDoc = dlgOpen.SelectedItems(1)
ImageBox.OLETypeAllowed = acOLELinked
ImageBox.Action = 1
End If
Set dlgOpen = Nothing
 
W

Wayne Morgan

This example will show you how to call the Windows Open File dialog. You can
use it to browse to your picture file and select it.

http://www.mvps.org/access/api/api0001.htm

There is a built-in Office Open File dialog, but the Windows API version
works better, in particular, you will have fewer problems when going from
one version of Access to another.
 
P

Peter

Dear Dennis,

Does it mean that I have to create a button and attach the code to the "On
Click" event ?

Thanks
 
D

Dennis

Depends on the design of your database. I did this in one of mine with a
button called Add Image which is why I suggested using a button. How are you
going to initiate them selecting a JPG file and inserting into the picture
frame box ?
 
Top