Hi Catchy,
to elaborate on what Sreedhar wrote:
txtPicture = "Path to Picture" & "\last_name" & "first_name" & ".jpg"
and what you said earlier:
There are pictures stored on disk named like "last_name first_name
date_of_birth.jpg"
to get Access to use what is IN the controls instead of literally
specifying last and firstname...
PathAndFilename = "Path to Picture" & "\" _
& [last_name_controlname] & " " _
& [first_name_controlname] _
& format([date_of_birth_controlname],"mm/dd/yy") _
& ".jpg"
(space underscore at the end of a line of code means that statement is
continued onto the next line)
I couldn't tell if there is a space before the names and the date (the
example left it out)... it is not a good idea to use spaces anyway, nor
is it good to use special characters such as slashes
Personally, when I use a date in a filename, I use this format: yymmdd
ie: Aug 7, 2006 --> 060807
and instead of space, use the underscore character _
if you already have a bunch of files stored with these names, it is
simple to write a little routine to go name them better... and if you
need help with that, just let us know
once you have the filepath and name constructed (btw,
currentproject.path gets the path of your database), you can do this:
'~~~~~~ in a report:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
With controlname_for_image
If Dir(Me.controlname_with_path_and_filename) <> "" Then
.Visible = True
.Picture = Me.controlname_with_path_and_filename
Else
.Visible = False
End If
End With
End Sub
if you are using a variable to construct the path and filename,
substitute it in for
Me.controlname_with_path_and_filename
the image control is the icon on the toolbox with the mountains and the sun
'~~~~~~ on a form:
you use the same method, and call the code on the form Current event as
well as the AfterUpdate event of any control that affects the filename
or filepath
Warm Regards,
Crystal
*

have an awesome day

*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*
Hi,
It's a bad idea to store pictures as OLE objects. Take a look at
Northwind Sample db shipped with Access. Have a glance at Employees
table and form. That will give you pointers as to how to store only
the path to the pictures as text field.
for setting the name of the picture, you can simply concatenate:
txtPicture = "Path to Picture" & "\last_name" & "first_name" & ".jpg"
Hope that helps.