Default images in a report

RLauterbach

New member
Local time
Today, 12:04
Joined
Oct 13, 2011
Messages
4
I have a report in which I wish to display different logos depending on the customer chosen, pulled from an image field in the customer table. Only a few customers have a bitmap entered in the customer table. I would like to have a default bitmap (our logo) for any customer with nothing in the image field. Putting the default bitmap into the table for every customer without a logo would make the database huge. I tried setting up an IIf situation in the report. When a bitmap exists, it prints. When none exists, the default doesn't print.

Can anyone offer suggestions?
 
What you should be doing is storing the images on your hard drive and using the full path to display the image related to a customer. Have a look at this:

http://support.microsoft.com/kb/285820

Then for a default image, you would simply do:

Code:
=Nz([PathField], "C:\[COLOR=Red]Path to default image[/COLOR]")
This means, if [PathField] is Null (or empty) use the path to the default image instead. Ensure that in the PathField, the Allow Zero-Length property is set to No.
 
Which version of Access are you using?
 
Code:
=Nz([PathField], "C:\[COLOR=Red]Path to default image[/COLOR]")
Expanding on this a little...with this your default image must have the same root as your database.

Code:
dim Path as string
dim File as string
dim FullPath as string
Path = currentproject.path
File = "\default image location.jpg"
FullPath= Path & File
me.yourimagefield.defaultimage=Nz([PathField], FullPath)

".defaultimage" may be a off a little. Intellisense will probably tell you what it really is.
 
It's not a must but it makes perfect sense to do so. Also I don't think an Image Control has a DefaultImage property.

If you do put the image in the same directory as your database, you can still do it in the Control Source in one line:
Code:
=Nz([PathField], CurrentProject.Path & "\Image Name.bmp")
 
Thanks all.

I neglected to mention that I am using Access 2003 at the moment.

Things I read made a big point of portability, i.e. moving the database to a different location and losing the connection to the images. It was mentioned in these posts also, but you've offered recommendations to avoid the issue, so I'll try them.
 
Does default picture is visible in report preview?
 
No, if I choose a customer with no bmp in its record, nothing shows in preview. If I choose a customer that does have a bmp, the image shows in preview and in print.
 
I didn't want to allow the late comment to go unanswered. I have not had time to implement the recommendations, so I can't say for certain it is resolved.
 

Users who are viewing this thread

Back
Top Bottom