displaying pictures from access database

M

MartyMart

Hello,

I would like to know how I can display a picture instead of text from an
Access database with Infopath 2003?

So far I don't have any problems to display simple text with an expression
box but is there a way to do the same with pictures?

Since my data are only pictures, I would like to be able to display picture
from an access database when someone is selecting an option with a pull down
menu.

Is there a way to display picture in an expression box? When I tried to do
so, it's only appears as binary code instead of the picture itself.

Any help would be very appreciated!

thanks!
 
G

Greg Collins [InfoPath MVP]

An expression box was designed to only show text. You can get an expression box to display rich content by manually editing the .xsl file and changing the line from:

<xsl:value-of select="my:field1"/>

to:

<xsl:copy-of select="my:field1/node()"/>

But this structure is not directly supported by InfoPath 2003 (not sure about InfoPath 2007) and you will likely lose your change during a subsequent save of the template from the designer.

You should be using a Picture Control to accomplish your task. And even then, long data types (i.e. images, etc) are not directly supported by InfoPath 2003 either--so you might need a Web service for this.

Hope this was helpful.
 
M

MartyMart

How can I edit the xsl file manually? I've tried to find an editor in
Infopath but the only one is the Microsoft Script editor that seems to be for
..js files and applets. Also I've tried
 
G

Greg Collins [InfoPath MVP]

You extract the form files (File menu) and then you can use a text editor on the XSL file.
 
M

MartyMart

Thanks Greg for your help so far! Very appreciated.

You said that I can display a picture within an expression box by changing
the source code. That's what I did. But it doesn't work. I think I'm missing
something here since even if I put a regular Rich Text box, I can't display a
picture from it. It's all binary stuff.

Is there something else I should do ?

thanks again!
 
G

Greg Collins [InfoPath MVP]

Yes, you're right--I'm sorry. The copy-of will allow rich text... but Internet Explorer (which is what InfoPath uses to render the views) does not understand the format of the inline pictures. And thus my suggestion will not work. It is useful however if you want to display rich text in an expression box.

That asside, I'm left to recommend that the only way you'll get your picture displayed is by using a picture control. Since your field is probably coming back as a string datatype, you likely won't even get the picture control to display it correctly. Picture controls require a base64 datatype to display their image--string doesn't work.

So to make this happen, you'd need a base64 datatype field in the main or a secondary dom. Then you would, on load or on query , copy your picture string from your Access field to the base64 field and bind a picture control to that field in the view.

Hope this was helpful.
 

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