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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|