Images in a Report.

J

John Shanley

Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from the
members table, including a photo. I've used a Fial DialogFilePicker to
capture the address of the photo. I'm trying to use a label report to print
the ID Cards. This looks grand and has almost everything that I want. The
only problem is seeing the photo!!! I'm trying to use an image frame on the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220 Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 
P

PC Datasheet

[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp
 
D

Douglas J. Steele

In John's example, though, he has [Photograph] in quotes, so it doesn't
really matter what value it represents!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



PC Datasheet said:
[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


John Shanley said:
Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from the
members table, including a photo. I've used a Fial DialogFilePicker to
capture the address of the photo. I'm trying to use a label report to print
the ID Cards. This looks grand and has almost everything that I want. The
only problem is seeing the photo!!! I'm trying to use an image frame on the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220 Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 
J

John Shanley

Sorry, Photograph is the text box that contains the path of the photo. It's
taken from the Table that contains all the data!!!

Douglas J. Steele said:
What is [Photograph]?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



John Shanley said:
Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from the
members table, including a photo. I've used a Fial DialogFilePicker to
capture the address of the photo. I'm trying to use a label report to
print the ID Cards. This looks grand and has almost everything that I
want. The only problem is seeing the photo!!! I'm trying to use an image
frame on the report to show the appropriate photo using the following
code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220 Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 
J

John Shanley

I was led to believe that when setting the picpath value, I had to put the
Field Name in quotes and brackets (i.e. - "[Photograph]") is this not
correct????

Douglas J. Steele said:
In John's example, though, he has [Photograph] in quotes, so it doesn't
really matter what value it represents!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



PC Datasheet said:
[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


John Shanley said:
Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from the
members table, including a photo. I've used a Fial DialogFilePicker to
capture the address of the photo. I'm trying to use a label report to print
the ID Cards. This looks grand and has almost everything that I want.
The
only problem is seeing the photo!!! I'm trying to use an image frame on the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220 Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 
P

PC Datasheet

No! Change this:
Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath
To:
Me!Photo.Picture = Me!Photograph

Note: The above code needs to be in the form's current event.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


John Shanley said:
I was led to believe that when setting the picpath value, I had to put the
Field Name in quotes and brackets (i.e. - "[Photograph]") is this not
correct????

Douglas J. Steele said:
In John's example, though, he has [Photograph] in quotes, so it doesn't
really matter what value it represents!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



PC Datasheet said:
[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from the
members table, including a photo. I've used a Fial DialogFilePicker to
capture the address of the photo. I'm trying to use a label report to
print
the ID Cards. This looks grand and has almost everything that I want.
The
only problem is seeing the photo!!! I'm trying to use an image frame on
the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220 Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 
T

Terry

John,

Assuming [photograph] is control name on your report just
[photograph] should do. Note that the [photograph] field
must be on your report not just in your record source -
set visible OFF if you don't want it to print. The code
you are using looks ok to me (other than the quotes). It
should be in the section's "on format" or "on print"
event. The section that contains the image.

To check if the photo really exists you can do something
like:

If dir(picpath)= "" then
'do something because the file isn't there'
end if

As a troubleshooting tip, try:
Dim picpath As String
picpath = "[Photograph]" msgbox picpath ' check what picpath is being set to.
[Photo].Picture = picpath

HTH,

Terry

-----Original Message-----
I was led to believe that when setting the picpath value, I had to put the
Field Name in quotes and brackets (i.e. - "[Photograph]") is this not
correct????

In John's example, though, he has [Photograph] in quotes, so it doesn't
really matter what value it represents!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from the
members table, including a photo. I've used a Fial DialogFilePicker to
capture the address of the photo. I'm trying to use a label report to
print
the ID Cards. This looks grand and has almost everything that I want.
The
only problem is seeing the photo!!! I'm trying to use an image frame on
the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220 Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!


.
 
D

Douglas J. Steele

You have to put the path in quotes, not the name of the field that holds the
path.

Dim picpath As String

picpath = [Photograph]
[Photo].Picture = Chr$(34) & picpath & Chr$(34)

(Chr$(34) is ")

In actual fact, though, I'd recommend picpath = Me.Photograph

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



John Shanley said:
I was led to believe that when setting the picpath value, I had to put the
Field Name in quotes and brackets (i.e. - "[Photograph]") is this not
correct????

Douglas J. Steele said:
In John's example, though, he has [Photograph] in quotes, so it doesn't
really matter what value it represents!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



PC Datasheet said:
[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from the
members table, including a photo. I've used a Fial DialogFilePicker to
capture the address of the photo. I'm trying to use a label report to
print
the ID Cards. This looks grand and has almost everything that I want.
The
only problem is seeing the photo!!! I'm trying to use an image frame on
the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220 Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 
J

John Shanley

Not having any luck with that!!! It's telling me that I've entered an
expression with no value!!!!

Any ideas???

PC Datasheet said:
No! Change this:
Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath
To:
Me!Photo.Picture = Me!Photograph

Note: The above code needs to be in the form's current event.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


John Shanley said:
I was led to believe that when setting the picpath value, I had to put
the
Field Name in quotes and brackets (i.e. - "[Photograph]") is this not
correct????

Douglas J. Steele said:
In John's example, though, he has [Photograph] in quotes, so it doesn't
really matter what value it represents!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from
the
members table, including a photo. I've used a Fial DialogFilePicker
to
capture the address of the photo. I'm trying to use a label report to
print
the ID Cards. This looks grand and has almost everything that I want.
The
only problem is seeing the photo!!! I'm trying to use an image frame on
the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220
Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 
D

DebbieG

This worked for me:

In the Detail section of my report the properties of my Image control are:

Name = MyPicture
Picture Type = Embedded
Size Mode = Zoom
Alignment = Center
Border Style = Transparent
Visible = No

My field that holds the path of the picture is called PicturePath and is in the Detail section but Visible = No.

In the Detail properties On Print event:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error GoTo GotError
If IsNull(Me.PicturePath) Then
Me.MyPicture.Visible = False
Else
Me.MyPicture.Picture = Me.PicturePath
Me.MyPicture.Visible = True
End If

ExitSub:
Exit Sub

GotError:
MsgBox Err.Number & vbCrLf & Err.Description
Resume ExitSub
End Sub

Hope this helps you,
Debbie


| Hi,
|
| I'm setting up a database for membership.
|
| I want to be able to print ID Cards for members, using fields from the
| members table, including a photo. I've used a Fial DialogFilePicker to
| capture the address of the photo. I'm trying to use a label report to print
| the ID Cards. This looks grand and has almost everything that I want. The
| only problem is seeing the photo!!! I'm trying to use an image frame on the
| report to show the appropriate photo using the following code:
|
| Dim picpath As String
| picpath = "[Photograph]"
| [Photo].Picture = picpath
|
| Unfortunately, it keeps giving me an error message when I try to view
| theprint preview!! The error message is: "Runtime error 2220 Microsoft
| Access can't open the file '[Photograph]'
|
| Any ideas???
|
| All help would be greatly appreciated!!!!
|
| PS - I'm using Access 2002 (XP)!!
|
|
 
P

PC Datasheet

Change code to:
If Not Is Null(Me!Photograph) Then
Me!Photo.Picture = Me!Photograph
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




John Shanley said:
Not having any luck with that!!! It's telling me that I've entered an
expression with no value!!!!

Any ideas???

PC Datasheet said:
No! Change this:
Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath
To:
Me!Photo.Picture = Me!Photograph

Note: The above code needs to be in the form's current event.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


John Shanley said:
I was led to believe that when setting the picpath value, I had to put
the
Field Name in quotes and brackets (i.e. - "[Photograph]") is this not
correct????

In John's example, though, he has [Photograph] in quotes, so it doesn't
really matter what value it represents!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



[Photograph] has to be the full path to the picture. Something like:
C:\MyPicturesFolder\Photos\JoeBlow.bmp

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Hi,

I'm setting up a database for membership.

I want to be able to print ID Cards for members, using fields from
the
members table, including a photo. I've used a Fial DialogFilePicker
to
capture the address of the photo. I'm trying to use a label report to
print
the ID Cards. This looks grand and has almost everything that I want.
The
only problem is seeing the photo!!! I'm trying to use an image
frame
on
the
report to show the appropriate photo using the following code:

Dim picpath As String
picpath = "[Photograph]"
[Photo].Picture = picpath

Unfortunately, it keeps giving me an error message when I try to view
theprint preview!! The error message is: "Runtime error 2220
Microsoft
Access can't open the file '[Photograph]'

Any ideas???

All help would be greatly appreciated!!!!

PS - I'm using Access 2002 (XP)!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top