Solved

How to reference report control for Picture Property of Image

Posted on 2008-10-13
6
438 Views
Last Modified: 2013-11-28
I have a report which, through a query, makes available a field called PictureFile.  I want to select an image by inserting that field name in the Picture Property of the Image control which will display that picture.  If I enter the bare name  -        PictureFile    -, I get an error that says that file "PictureFile" cannot be opened.  Same if I use quotes, same if enclosed in brackets,  same if brackets inside quotes.

What syntax do I use in the Picture property of an Image control to tell it to use the TEXT represented by a control on the report or on the original table, rather than the text of the control or field?

I need to do this on a report that reads many records, each of which has a different picture associated.

If someone can tell me what event changes for each new record, I could do it in VBA code.
0
Comment
Question by:netsmithcentral
  • 2
  • 2
  • 2
6 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22709026
netsmithcentral.

?

What happened to our previous posts?
(I posted that you should us an image control, then you posted that you were using PDF's)?

In any event, I have not seen ant techniques on how this can be done.

However, it can be done quite easilly in a form.

JeffCoachman
0
 
LVL 84
ID: 22709824
What type of data does your field PictureFile contain? Is this an OLE field, or is this a text field that contains the path to the picture?
0
 
LVL 12

Author Comment

by:netsmithcentral
ID: 22712255
The PictureFile  field contains the text of the complete path and filename to the picture.

Sorry, I have no idea what Jeff Coachman is talking about.  This is my first post on this subject.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 12

Accepted Solution

by:
netsmithcentral earned 0 total points
ID: 22714223
I was able to change the picture to be displayed programmatically by using the On Page Event for the report:

Private Sub Report_Page()
Dim strFullPicturePath As String

strFullPicturePath = Reports!rptBatchPrintContract!txtImageName

'test for existence of picture file
If (Len(Dir(strFullPicturePath, vbNormal))) > 0 Then
 
'On True set property picture equal to string from txtImageName
Reports!rptBatchPrintContract!ImageFrame.Picture = strFullPicturePath

Else

'display default photo
Reports!rptBatchPrintContract!ImageFrame.Picture = "c:\database\pictures\defaultpicture.jpg"
End If

End Sub
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22715385
netsmithcentral,

It looks like I got this post confused with another post I was involved in.

Sorry.
;-(

So, ...Problem Solved?

JeffCoachman
0
 
LVL 84
ID: 22715927
So my post helped you to your solution, and while it wasn't a full solution you're deleting this and awarding no points ... you're the 4th one I've added to my list today ... good luck with your other questions, I'm sure you'll get sufficient assistance from the other Experts.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now