Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Pictures in report - how to

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
news2@rgcle.com - 21 Jan 2008 18:47 GMT
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?
fredg - 21 Jan 2008 19:18 GMT
> 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]

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

news2@rgcle.com - 21 Jan 2008 22:13 GMT
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
[quoted text clipped - 14 lines]
> use:
> Me.ImageName.Picture = "c:\FolderName\" & Me.[FieldName]
Bill - 21 Jan 2008 23:11 GMT
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:
>
[quoted text clipped - 27 lines]
>> use:
>> Me.ImageName.Picture = "c:\FolderName\" & Me.[FieldName]
fredg - 22 Jan 2008 00:16 GMT
> Thank you, but I still have a stumbling block:
>
[quoted text clipped - 27 lines]
>> 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.

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Bill - 22 Jan 2008 01:21 GMT
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

>> Thank you, but I still have a stumbling block:
>>
[quoted text clipped - 42 lines]
> Me.ImageName.Picture = Me.[PictureLink]
> Exit the code window and save the changes.
news2@rgcle.com - 22 Jan 2008 02:52 GMT
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
fredg - 22 Jan 2008 05:07 GMT
> 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.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

news2@rgcle.com - 22 Jan 2008 15:29 GMT
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
[quoted text clipped - 5 lines]
> (A little quirk in Access when referencing fields
> in VBA code.)
Bill - 22 Jan 2008 16:56 GMT
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:
>
[quoted text clipped - 25 lines]
>> (A little quirk in Access when referencing fields
>> in VBA code.)
news2@rgcle.com - 22 Jan 2008 19:18 GMT
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
Bill - 22 Jan 2008 19:32 GMT
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

> Thank you again!
>
[quoted text clipped - 20 lines]
>
> Dick
fredg - 22 Jan 2008 19:38 GMT
> Thank you again!
>
[quoted text clipped - 19 lines]
>
> 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.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

news2@rgcle.com - 22 Jan 2008 21:03 GMT
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!
> >
[quoted text clipped - 41 lines]
> The picture appears only if there is one. otherwise the Image is made
> not visible and the Label appears.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.