Graphics in Report

D

DanRoy

I am designing a report which contains an Image Control. Within the
application, I have a table, "ECP Schedule Picture",which is linked to the
key sort field for the report and a second field containing the filepath
"[ECP Picture link]" and name of the 5 GIF corresponding to the 5 unique
"Pages" in the report. Clicking on the Image Control, I edited the
properties to identify one of the GIF files directly, ie C:\test\ECP0412.gif.
If I run the report with a defined GIF entered in the ImageControl.Picture
field, I see the same GIF for all 5 pages of the report. I want to display
each of the unique GIF files with the corresponding key field on the five
pages of the report.

I Have tried loading the picture field with [ECP Schedule Picture]![ECP
Picture link] with no success. I have tried loading the hyperlink fields in
properties, also with no success. I do have some VB code in my application.
How would I relate a section of VB code to control what is displayed in an
Image Control as each page of the report is prepared?
 
L

Larry Linson

If you click on the properties and assign a GIF file to an Image Control,
and never change it, it is working properly to show that picture every time
the Image control is displayed. What did you think it was supposed to do?

If, however, the Image control is in the Detail Section, so that each of the
"5 unique 'Pages'" in the Report is actually a Detail Section, you could, in
the OnPrint or OnFormat event, set the Picture property of that Image
Control to the appropriate image file location (path and filename) to show
the picture that applies to the particular record.

Larry Linson
Microsoft Office Access MVP
 
D

DanRoy

Larry,

Perhaps if I explain in a different way. I have the Image control
(Image220) in the details section. I want the image to change to a different
picture whenever a text1 field change occurs, and to load the filename
indicated in the text1 field. My report is working perfectly except that I
cannot find a way to tell the application I want to change the pciture.

When I try to edit the Image by right-clicking the image control, I can
identify a Picture to be printed in the pciture field. To test the
application out, this is how I loaded the page to ensure I could get a
graphic to print. Next, I wanted to be able to change the picture as the
Text1 fieldname changed. The Text1 field name is also in the details
section. This did not work!

I read your initial reply to me and I was successful in creating a report
event for "On_Format" as follows

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Image220.???? = "c:\Test\ECP0412.gif"
End Sub


I would have expected to have identified the control, image220.picture, as
the receiver of the filepath and filename, but Picture was not an available
choice to me.


I know i am 2 keystrokes away from the answer I need but I have invested
several hours already trying to figure this out. Can you tell me if I am
following a fruitful path or do I need to regroup and try a different
approach?

Thanks

Dan


Larry Linson said:
If you click on the properties and assign a GIF file to an Image Control,
and never change it, it is working properly to show that picture every time
the Image control is displayed. What did you think it was supposed to do?

If, however, the Image control is in the Detail Section, so that each of the
"5 unique 'Pages'" in the Report is actually a Detail Section, you could, in
the OnPrint or OnFormat event, set the Picture property of that Image
Control to the appropriate image file location (path and filename) to show
the picture that applies to the particular record.

Larry Linson
Microsoft Office Access MVP


DanRoy said:
I am designing a report which contains an Image Control. Within the
application, I have a table, "ECP Schedule Picture",which is linked to the
key sort field for the report and a second field containing the filepath
"[ECP Picture link]" and name of the 5 GIF corresponding to the 5 unique
"Pages" in the report. Clicking on the Image Control, I edited the
properties to identify one of the GIF files directly, ie
C:\test\ECP0412.gif.
If I run the report with a defined GIF entered in the ImageControl.Picture
field, I see the same GIF for all 5 pages of the report. I want to
display
each of the unique GIF files with the corresponding key field on the five
pages of the report.

I Have tried loading the picture field with [ECP Schedule Picture]![ECP
Picture link] with no success. I have tried loading the hyperlink fields
in
properties, also with no success. I do have some VB code in my
application.
How would I relate a section of VB code to control what is displayed in an
Image Control as each page of the report is prepared?
 
O

OMS

Hi,

Embed your image then set "Visible" in Properties to "No". Then you might
try a Case statement like this:

Select Case Trim(Me.text1)
Case "Image220"
Me.Image220.Visible = True
Case "Image221"
Me.Image221.Visible = True
End Select

I'm sure there's a way without embedding but I haven't tried that.

Good Luck,OMS


DanRoy said:
Larry,

Perhaps if I explain in a different way. I have the Image control
(Image220) in the details section. I want the image to change to a
different
picture whenever a text1 field change occurs, and to load the filename
indicated in the text1 field. My report is working perfectly except that
I
cannot find a way to tell the application I want to change the pciture.

When I try to edit the Image by right-clicking the image control, I can
identify a Picture to be printed in the pciture field. To test the
application out, this is how I loaded the page to ensure I could get a
graphic to print. Next, I wanted to be able to change the picture as the
Text1 fieldname changed. The Text1 field name is also in the details
section. This did not work!

I read your initial reply to me and I was successful in creating a report
event for "On_Format" as follows

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Image220.???? = "c:\Test\ECP0412.gif"
End Sub


I would have expected to have identified the control, image220.picture, as
the receiver of the filepath and filename, but Picture was not an
available
choice to me.


I know i am 2 keystrokes away from the answer I need but I have invested
several hours already trying to figure this out. Can you tell me if I am
following a fruitful path or do I need to regroup and try a different
approach?

Thanks

Dan


Larry Linson said:
If you click on the properties and assign a GIF file to an Image Control,
and never change it, it is working properly to show that picture every
time
the Image control is displayed. What did you think it was supposed to
do?

If, however, the Image control is in the Detail Section, so that each of
the
"5 unique 'Pages'" in the Report is actually a Detail Section, you could,
in
the OnPrint or OnFormat event, set the Picture property of that Image
Control to the appropriate image file location (path and filename) to
show
the picture that applies to the particular record.

Larry Linson
Microsoft Office Access MVP


DanRoy said:
I am designing a report which contains an Image Control. Within the
application, I have a table, "ECP Schedule Picture",which is linked to
the
key sort field for the report and a second field containing the
filepath
"[ECP Picture link]" and name of the 5 GIF corresponding to the 5
unique
"Pages" in the report. Clicking on the Image Control, I edited the
properties to identify one of the GIF files directly, ie
C:\test\ECP0412.gif.
If I run the report with a defined GIF entered in the
ImageControl.Picture
field, I see the same GIF for all 5 pages of the report. I want to
display
each of the unique GIF files with the corresponding key field on the
five
pages of the report.

I Have tried loading the picture field with [ECP Schedule Picture]![ECP
Picture link] with no success. I have tried loading the hyperlink
fields
in
properties, also with no success. I do have some VB code in my
application.
How would I relate a section of VB code to control what is displayed in
an
Image Control as each page of the report is prepared?
 
L

Larry Linson

DanRoy said:
Next, I wanted to be able to change the picture
as the Text1 fieldname changed. The Text1 field
name is also in the details section. This did not work!

This is not what you showed in code. And "did not work" is not very
specific. I hope what you wrote actually translates to "change the picture
when the value displayed in the Text1 Control changes" and in a Report, that
will only change when a new Record is displayed. "Text1 fieldname changed"
just does not make any sense, assuming as I do, that "Text1" is a Text Box
in your Report.

No, I did not need additional explanation. I am convinced that I understood,
and that I gave you the correct answer. I rarely go back and review my
"archives" to determine detail such as "Picture will not show as a property
in Intellisense, but you can just type it in and it works just fine". Now I
did go back and review, to make sure I had not overlooked something else.

For my purposes, I do not refer to Controls without prefixing them with
either the "Me" shorthand to represent the current Form or Report, or a
reference to a particular Form in the Forms collection. It is always
difficult to guess in what areas the Access team may decide to be "stricter"
in interpreting code statements. And, for my own and others' convenience, I
use the Reddick VBA Naming Convention (usually at the simplest level),
described in detail at http://grr.xoc.net.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Image220.???? = "c:\Test\ECP0412.gif"
End Sub

I would have expected to have identified the control, image220.picture, as
the receiver of the filepath and filename, but Picture was not an
available
choice to me.

Whatever you expect or see in Intellisense, Picture is a property of the
Image control. In a sample database, the following works for me, even though
when I enter character-by-character, the same line of code immediately below
it, Picture does not show up in the list of Properties for Intellisense in
Access 2003.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Me!imgImage.Picture = Me.txtImagePathAndFile
End Sub

Bug? Probably. Worth worrying about? No, type in the value and see if it
works... You are not limited to "choosing" a value. And, this is not the
only property that doesn't show up in Intellisense in Access.

In my case, I wanted to display a different picture for each record, and the
Control "txtImagePathAndFile" is bound to the Field containing the path and
filename of the picture for that record. I note that once I put the Image
control on the Report, I went back and deleted the original value from the
Picture property, so that Property in design view shows (none).

Good luck with your Report,

Larry Linson
Microsoft Office Access MVP
 
D

DanRoy

Larry,

You did provide good guidancein your first post. I nneded to work harder to
understand it in my context. I am learning and am not familiar with all of
the conventions. I really thought intellisense provided all of the available
properties. And, text1 on my report was a bound control named text1.

Thanks for you suggestions on using the "Me" prefix for controls. I will
try to use in my application and see what happens that is different.

I did solve my dilemma of not being able to show the corresponding graphic
on the same page as the rest of the details for that graphic. Thank you for
you suggestions. I had to "discover" how to add an event to a report. I
never had to do that before.

Dan
 
L

Larry Linson

Larry wrote

And, I've reported some to Microsoft, but don't have SP3 loaded on Access
2003 nor Access 2007 handily available to check and see if this has been
fixed... I may have a record of them, but offhand don't remember which I
reported.

Larry Linson
Microsoft Office Access MVP
 
L

Larry Linson

DanRoy said:
Larry,

I really thought intellisense provided all of the
available properties.

It's always worth a try... it appears that Intellisense does not, at
runtime, execute code to determine the properties, but that the values have
been coded somewhere (and some of them missed). If, when it is executed, the
property works, all is well.
Thanks for you suggestions on using the "Me" prefix
for controls. I will try to use in my application and
see what happens that is different.

The difference may be none, but sometimes they decide to be stricter in
their enforcement of the instruction syntax when they release a new
version... that's happened a couple of times in Access' history, and
required going back and modifying code that took advantage of lax syntax
checking.
I did solve my dilemma of not being able to show the
corresponding graphic on the same page as the rest
of the details for that graphic. Thank you for
you suggestions.

I'm happy that my suggestions were helpful.
I had to "discover" how to add an event to a report. I
never had to do that before.

There's a lot you can do without using event code, but many of us use it
often enough that we'd really miss it if the capability were not there.

In my view, I've never worked with a more capable Report Generator than
Access', and my use of Report Generators goes all the way back to IBM COBOL
version 12 or so (that would be nigh onto forty years ago).

Larry
 

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