A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Link an Image to a field



 
 
Thread Tools Display Modes
  #1  
Old July 30th, 2009, 09:11 AM posted to microsoft.public.access.reports
masremi
external usenet poster
 
Posts: 5
Default Link an Image to a field

Hello !

I have a Field "Item" on a report and I would like to show the image of the
item.
There is not the path on a field, but the path is still the same only the
name of the item change.

So what I want is to add an Image control on the report and write the
information :

Image1.Picture = "C:\My pictures\" & [item] & ".jpg"

That is about what I would ... in that way the image should show the item on
a picture.

Someone could explain me how to obtain that result ?

Thank you.
  #2  
Old July 30th, 2009, 10:01 PM posted to microsoft.public.access.reports
Sam Davis
external usenet poster
 
Posts: 23
Default Link an Image to a field

Assuming the image file "C:\My pictures\" & [item] & ".jpg" exists then
simply add your line of code to the Print event of the section where the
value of the field [Item] changes.

However, if your folder is supposed to refer to the user's Windows "My
Pictures" folder then it won't work. You'll need code to find this folder as
it will be different for each user. You'll need a function that uses
SHGetFolderPath (from memory) to determine the precise "My Pictures"
directory. Search for SHGetFolderPath...

HTH
Sam


"masremi" wrote in message
...
Hello !

I have a Field "Item" on a report and I would like to show the image of
the
item.
There is not the path on a field, but the path is still the same only the
name of the item change.

So what I want is to add an Image control on the report and write the
information :

Image1.Picture = "C:\My pictures\" & [item] & ".jpg"

That is about what I would ... in that way the image should show the item
on
a picture.

Someone could explain me how to obtain that result ?

Thank you.



  #3  
Old July 31st, 2009, 06:26 PM posted to microsoft.public.access.reports
masremi
external usenet poster
 
Posts: 5
Default Link an Image to a field

Hello !

Don't worry fo the path, it is just an example !

On the print event ... nothing hapen !

The field [item] and the control "Image are on "headgroup0"

If I put the code on the "click" it is working ... but it puts the same
picture on all the control "Image" instead change it only in the row where I
have clicked.

Could you write a code to explain me which private_sub and Event should I use.

Thanks.

"Sam Davis" wrote:

Assuming the image file "C:\My pictures\" & [item] & ".jpg" exists then
simply add your line of code to the Print event of the section where the
value of the field [Item] changes.

However, if your folder is supposed to refer to the user's Windows "My
Pictures" folder then it won't work. You'll need code to find this folder as
it will be different for each user. You'll need a function that uses
SHGetFolderPath (from memory) to determine the precise "My Pictures"
directory. Search for SHGetFolderPath...

HTH
Sam

  #4  
Old August 1st, 2009, 02:21 PM posted to microsoft.public.access.reports
masremi
external usenet poster
 
Posts: 5
Default Link an Image to a field

Hello!

I have risolved ! I have done a new report and it works using the event
"format"

Private Sub Détail_Format(Cancel As Integer, FormatCount As Integer)
Dim strPath As String, strImage As String
strImage = [item]
strPath = "c:\my pictures\" & strImage & ".jpg"
On Error Resume Next
Me.Image3.Picture = strPath
End Sub

Thanks for the help !
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.