Group:  Other Microsoft Office Products ยป microsoft.public.infopath
Thread: displaying pictures from access database

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

displaying pictures from access database
MartyMart 08.08.2006 14:24:02
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!
Re: displaying pictures from access database
"Greg Collins [InfoPath MVP]" <gcollins_AT_msn_DOT_com> 08.08.2006 17:44:59
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.

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Visit InfoPathDev ( http://www.InfoPathDev.com )


Re: displaying pictures from access database
MartyMart 08.08.2006 19:05:01
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

"Greg Collins [InfoPath MVP]" wrote:

[Quoted Text]
> 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.
>
> --
> Greg Collins [Microsoft MVP]
> Visit Brain Trove ( http://www.BrainTrove.com )
> Visit InfoPathDev ( http://www.InfoPathDev.com )
>
>
>
Re: displaying pictures from access database
"Greg Collins [InfoPath MVP]" <gcollins_AT_msn_DOT_com> 09.08.2006 19:16:51
You extract the form files (File menu) and then you can use a text editor on the XSL file.

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Visit InfoPathDev ( http://www.InfoPathDev.com )


Re: displaying pictures from access database
MartyMart 11.08.2006 13:36:01
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!


"Greg Collins [InfoPath MVP]" wrote:

[Quoted Text]
> 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.
>
> --
> Greg Collins [Microsoft MVP]
> Visit Brain Trove ( http://www.BrainTrove.com )
> Visit InfoPathDev ( http://www.InfoPathDev.com )
>
>
>
Re: displaying pictures from access database
"Greg Collins [InfoPath MVP]" <gcollins_AT_msn_DOT_com> 11.08.2006 16:26:21
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.

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Visit InfoPathDev ( http://www.InfoPathDev.com )


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net