Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image in report

Status
Not open for further replies.
Hi,

I have a report which I am trying to insert an image.
Sometimes there is an image to be loaded or sometimes the cursor driving the report does not have an image to load

Now this works OK when there is an image, but when the there is no image it fails
In the report control I have tried variations of the below code in the control source (Set to expression/variable)

Code:
iif(empty(cReport.Image1file),"",cReport.Image1file)

For some reason the control MUST have an image to load otherwise there is an error
I could go down the road of having a dummy jpg file, but I would rather not, unless there is another way


 
Go the empty.jpg route. Image controls need an image.
 
I agree with Dan. Creating an empty file is the easiest solution. Make it the same background colour as the report background (probably white). Place its filename in your cReport.Image1file field when no other image is available.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi Mike,

I got around it fairly simply without creating a dummy file
in the report I entered into the "Print When" tab, "Print only when expression is true" section this code

Code:
!empty(creport2.Image2)

That works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top