Pictures in report - how to

N

news2

I want to create a report which has pictures along with text for the
individuals in the data base. I have the picture paths in the data base.

Dow do I create a report so that the pictures themselves will be included?
 
F

fredg

I want to create a report which has pictures along with text for the
individuals in the data base. I have the picture paths in the data base.

Dow do I create a report so that the pictures themselves will be included?

Add an Image control to the report.
After you add the control delete the control's Picture property.

Does the picture path include the folder AND the picture name,
i.e. "c:\PictureFolder\PictureName.jpg" ?
Code the Report Section's Format event that the control is in:
Me.ImageName.Picture = Me.[FieldName]

If the field only has the Picture Name, i.e. "PictureName.jpg" then
use:
Me.ImageName.Picture = "c:\FolderName\" & Me.[FieldName]
 
N

news2

Thank you, but I still have a stumbling block:

The field I have identified is [PictureLink].

The OnFormat event for the detail section is coded "Me.ImageName.Picture =
Me.[picturelink]"

When I change the report to print preview I get the error "....can't find
the macro 'Me'."

??
================

I want to create a report which has pictures along with text for the
individuals in the data base. I have the picture paths in the data
base.

Dow do I create a report so that the pictures themselves will be
included?

Add an Image control to the report.
After you add the control delete the control's Picture property.

Does the picture path include the folder AND the picture name,
i.e. "c:\PictureFolder\PictureName.jpg" ?
Code the Report Section's Format event that the control is in:
Me.ImageName.Picture = Me.[FieldName]

If the field only has the Picture Name, i.e. "PictureName.jpg" then
use:
Me.ImageName.Picture = "c:\FolderName\" & Me.[FieldName]
 
B

Bill

Is "picturelink" a field in the RecordSource of the
report? If so, then Me.Picturelink should suffice
as long as Picturelink is a fully qualified path.

Also, you'll have to create an invisible control
on your report with Picturelink as it RecordSource
so that you can reference that field in code.

What exactly are the attributes of Picturelink?
String?


Thank you, but I still have a stumbling block:

The field I have identified is [PictureLink].

The OnFormat event for the detail section is coded "Me.ImageName.Picture =
Me.[picturelink]"

When I change the report to print preview I get the error "....can't find
the macro 'Me'."

??
================

I want to create a report which has pictures along with text for the
individuals in the data base. I have the picture paths in the data
base.

Dow do I create a report so that the pictures themselves will be
included?

Add an Image control to the report.
After you add the control delete the control's Picture property.

Does the picture path include the folder AND the picture name,
i.e. "c:\PictureFolder\PictureName.jpg" ?
Code the Report Section's Format event that the control is in:
Me.ImageName.Picture = Me.[FieldName]

If the field only has the Picture Name, i.e. "PictureName.jpg" then
use:
Me.ImageName.Picture = "c:\FolderName\" & Me.[FieldName]
 
F

fredg

Thank you, but I still have a stumbling block:

The field I have identified is [PictureLink].

The OnFormat event for the detail section is coded "Me.ImageName.Picture =
Me.[picturelink]"

When I change the report to print preview I get the error "....can't find
the macro 'Me'."

??
================

I want to create a report which has pictures along with text for the
individuals in the data base. I have the picture paths in the data
base.

Dow do I create a report so that the pictures themselves will be
included?

Add an Image control to the report.
After you add the control delete the control's Picture property.

Does the picture path include the folder AND the picture name,
i.e. "c:\PictureFolder\PictureName.jpg" ?
Code the Report Section's Format event that the control is in:
Me.ImageName.Picture = Me.[FieldName]

If the field only has the Picture Name, i.e. "PictureName.jpg" then
use:
Me.ImageName.Picture = "c:\FolderName\" & Me.[FieldName]

I suspect you placed the line
Me.ImageName.Picture = Me.[PictureLink]
directly on the property sheet's Detail Format line.
That's not where it goes.
On the Detail format event line write
[Event Procedure]
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines write
Me.ImageName.Picture = Me.[PictureLink]
Exit the code window and save the changes.
 
B

Bill

Don't forget Fred's original instructions to put the
line of code in the OnFormat for the SECTION
that contains the image, which may or may not
be the DETAIL section.

And, don't forget to put an invisible control on
the report whose RecordSource is PictureLink.
(A little quirk in Access when referencing fields
in VBA code.)

Bill



fredg said:
Thank you, but I still have a stumbling block:

The field I have identified is [PictureLink].

The OnFormat event for the detail section is coded "Me.ImageName.Picture
=
Me.[picturelink]"

When I change the report to print preview I get the error "....can't find
the macro 'Me'."

??
================

On Mon, 21 Jan 2008 18:47:34 GMT, (e-mail address removed) wrote:

I want to create a report which has pictures along with text for the
individuals in the data base. I have the picture paths in the data
base.

Dow do I create a report so that the pictures themselves will be
included?

Add an Image control to the report.
After you add the control delete the control's Picture property.

Does the picture path include the folder AND the picture name,
i.e. "c:\PictureFolder\PictureName.jpg" ?
Code the Report Section's Format event that the control is in:
Me.ImageName.Picture = Me.[FieldName]

If the field only has the Picture Name, i.e. "PictureName.jpg" then
use:
Me.ImageName.Picture = "c:\FolderName\" & Me.[FieldName]

I suspect you placed the line
Me.ImageName.Picture = Me.[PictureLink]
directly on the property sheet's Detail Format line.
That's not where it goes.
On the Detail format event line write
[Event Procedure]
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines write
Me.ImageName.Picture = Me.[PictureLink]
Exit the code window and save the changes.
 
N

news2

Thanks to all of you; I didn't "get" that it was to be code. I'm beginning
to see the light, but can't work further on it until tomorrow.

Thanks again!!
Dick
 
F

fredg

Thanks to all of you; I didn't "get" that it was to be code. I'm beginning
to see the light, but can't work further on it until tomorrow.

Thanks again!!
Dick

Don't forget to change ImageName to whatever the actual name of your
Image control is.
 
N

news2

I believe I have done things as suggested:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ImageName.Picture = Me.[PictureLink]
End Sub

but when I try to compile the code I get "Method or data member not found"
on ImageName.

I have added a text box with the data control source as PictureLink.

Others have asked: a typical PictureLink is
C:\g\AllPix\Benner Shirley Ellen 1986.JPG

I am using Access 2003, in case that makes a difference.

Sorry to be such a pest....

Dick
 
B

Bill

Dick,
In the properties sheet for your image control, select
the "Other" tab and check to see if the name of the
control is in fact "ImageName".
Bill



I believe I have done things as suggested:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ImageName.Picture = Me.[PictureLink]
End Sub

but when I try to compile the code I get "Method or data member not found"
on ImageName.

I have added a text box with the data control source as PictureLink.

Others have asked: a typical PictureLink is
C:\g\AllPix\Benner Shirley Ellen 1986.JPG

I am using Access 2003, in case that makes a difference.

Sorry to be such a pest....

Dick


Don't forget Fred's original instructions to put the
line of code in the OnFormat for the SECTION
that contains the image, which may or may not
be the DETAIL section.

And, don't forget to put an invisible control on
the report whose RecordSource is PictureLink.
(A little quirk in Access when referencing fields
in VBA code.)
 
N

news2

Thank you again!

Making progress - a picture shows!

However, there's only one entry in the database which has a link to a
picture; in the report as soon as that person is processed all the rest of
the records show that same picture.

In an attempt to fix it, I put in

If Nz(Me.PictureLink) <> "" Then
Me.ImageName.Picture = Nz(Me.[PictureLink])
Else
Me.ImageName.Picture = ""
End If

But that seems to have had no effect.

Is it an "acceptable" solution if I have a blank picture (with "Not yet
available" in it, for instance) and use the link to it in lieu of the "" in
the else clause? It seems to work ok. Or is there a better solution?

Dick
 
B

Bill

By all means. When you have a situation such as yours,
it's always a good idea to have a "default" picture to
use when none others exist.
Bill
 
F

fredg

Thank you again!

Making progress - a picture shows!

However, there's only one entry in the database which has a link to a
picture; in the report as soon as that person is processed all the rest of
the records show that same picture.

In an attempt to fix it, I put in

If Nz(Me.PictureLink) <> "" Then
Me.ImageName.Picture = Nz(Me.[PictureLink])
Else
Me.ImageName.Picture = ""
End If

But that seems to have had no effect.

Is it an "acceptable" solution if I have a blank picture (with "Not yet
available" in it, for instance) and use the link to it in lieu of the "" in
the else clause? It seems to work ok. Or is there a better solution?

Dick

What is the Nz() supposed to do here?

You suggestion of having a blank picture is fine.
Another solution would be something like this:
Place a Label over the Image.
Set it's caption to "Picture not yet available"

Code the detail Format event:
If IsNull(Me.PictureLink) Then
Me.ImageName.Visible = False
Me.LabelName.Visible = True
Else
Me.ImageName.Picture = Me.[PictureLink]
Me.ImageName.Visible = True
Me.LabelName.Visible = False
End If

The picture appears only if there is one. otherwise the Image is made
not visible and the Label appears.
 
N

news2

Since PictureLink is a string and may either be null (never entered) or
empty (due to removal), I figure that to cover both cases the NZ() is
needed.

I tried your solution with the label and it works just fine.That way the
wording can be changed with less trouble than if a default image was used,
although the default picture certainly could be fancier.

Thanks to all that have helped me on this!

FWIW the project is a resident directory for a non-profit continuing-care
retirement community for seniors - and I'm about as senior as they come
<grin>.

Dick


Thank you again!

Making progress - a picture shows!

However, there's only one entry in the database which has a link to a
picture; in the report as soon as that person is processed all the rest
of
the records show that same picture.

In an attempt to fix it, I put in

If Nz(Me.PictureLink) <> "" Then
Me.ImageName.Picture = Nz(Me.[PictureLink])
Else
Me.ImageName.Picture = ""
End If

But that seems to have had no effect.

Is it an "acceptable" solution if I have a blank picture (with "Not yet
available" in it, for instance) and use the link to it in lieu of the ""
in
the else clause? It seems to work ok. Or is there a better solution?

Dick

What is the Nz() supposed to do here?

You suggestion of having a blank picture is fine.
Another solution would be something like this:
Place a Label over the Image.
Set it's caption to "Picture not yet available"

Code the detail Format event:
If IsNull(Me.PictureLink) Then
Me.ImageName.Visible = False
Me.LabelName.Visible = True
Else
Me.ImageName.Picture = Me.[PictureLink]
Me.ImageName.Visible = True
Me.LabelName.Visible = False
End If

The picture appears only if there is one. otherwise the Image is made
not visible and the Label appears.
 

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