473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Image linking for Report

I have a report that I want to print for a product specification sheet
with a photo of the product. I have the photos stored in a separate
folder from my Access 2000 database. I have a form that when I choose a
product all the info for that product appears on the form
appropriately, including the image path (e.g.
C:\ABCcompany\Prods\Item894654.jpg). The form's data appears
appropriately on the report for that item. How can I place an image on
the report and link it to the displayed path?

Thanks in advance!!

Nov 15 '06 #1
1 1921
You need to load
something like the routine below

on the format event of the report detail you need something like

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Call FindOldPhotoRpt(Me, Nz(HostPhotoPath), HostID)

End Sub
Public Function FindOldPhotoRpt(Rpt As Report, PhotoPath As String, ID As
Long)

'HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options ShowProgressDialog No

Dim MyDb As Database
Dim ImageTypeSet As Recordset
Dim Msg As String, FilterName As String

If Nz(ID) = 0 Or Nz(PhotoPath) = "" Then
Rpt!Photo.Picture = ""
Exit Function
End If

If Dir(PhotoPath) = "" Then ' not found
Msg = "Photo: " & PhotoPath & vbCrLf
Msg = Msg & "is not found at the above location (or is misspelled)"
MsgBox Msg, vbInformation, "Missing Photo"
Rpt.Photo.Picture = ""
Exit Function
End If

Set MyDb = CurrentDb
Set ImageTypeSet = MyDb.OpenRecordset("ImageTypes")

With ImageTypeSet
Do Until .EOF
If Right(Dir(PhotoPath), Len(!ImageType)) = !ImageType Then
.Close
GoTo LegalPhoto
End If
.MoveNext
Loop
.Close
End With

Rpt.Photo.Picture = "" ' Not a photo
Set ImageTypeSet = Nothing
Set MyDb = Nothing
Exit Function

LegalPhoto:
Rpt!Photo.Picture = PhotoPath
Set ImageTypeSet = Nothing
Set MyDb = Nothing

End Function

This is the routine I use.
One or 2 notes:
Assuming that all your pictures are JPGs you can delete anything to do with
the ImageType bit of the VB. This was in as certain types of pictures can
not be handled.
If you look at the registry there is a bit that says
'HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options ShowProgressDialog No. If it says Yes then you
will see an annoying dialogue box showing up that says something about
loading JPG
An example of the HostPhotoPath would be your
"C:\ABCcompany\Prods\Item894654.jpg). "
The HostID was a check on my bit of software that I was printing a person's
detail rather than some dummy information. This bit and the corresponding ID
can be omitted

I suppose it would have been easier to say

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Call FindOldPhotoRpt(Me, Nz(HostPhotoPath))

End Sub
Public Function FindOldPhotoRpt(Rpt As Report, PhotoPath As String)

'HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options ShowProgressDialog No

Dim MyDb As Database
Dim Msg As String, FilterName As String

If Nz(PhotoPath) = "" Then
Rpt!Photo.Picture = ""
Exit Function
End If

If Dir(PhotoPath) = "" Then ' not found
Msg = "Photo: " & PhotoPath & vbCrLf
Msg = Msg & "is not found at the above location (or is misspelled)"
MsgBox Msg, vbInformation, "Missing Photo"
Rpt.Photo.Picture = ""
Exit Function
End If

Rpt!Photo.Picture = PhotoPath

End Function

HTH

Phil

"Parasyke" <kr************@yahoo.comwrote in message
news:11*********************@f16g2000cwb.googlegro ups.com...
>I have a report that I want to print for a product specification sheet
with a photo of the product. I have the photos stored in a separate
folder from my Access 2000 database. I have a form that when I choose a
product all the info for that product appears on the form
appropriately, including the image path (e.g.
C:\ABCcompany\Prods\Item894654.jpg). The form's data appears
appropriately on the report for that item. How can I place an image on
the report and link it to the displayed path?

Thanks in advance!!

Nov 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Filips Benoit | last post by:
Dear All, I want a report for a list of products with its picture on the leftsite of the Productname and the P-price. So 3 controls in the detail-section: image (unbound, hight=5cm), P-name and...
6
by: Roger | last post by:
I have a report with a image displaying our company logo if I create an snapshot of this report, it appears to create an 'snp' file, but nothing is stored in the folder I tried both linked and...
1
by: Tom van Stiphout | last post by:
Access 2000. I have a report with an Image control on it, loaded with an aerial photograph. I want to draw small rectangles on that image. I tried the Line and PSet methods, but it appears they...
1
by: urange | last post by:
Hi to all, I am setting up a database which has to store a great number of images. I will therefore store the images not as OLE but as a text link to the file (maybe I'll try the BLOB-solution)....
13
by: kojo88 | last post by:
Hi there i got recommended to this site by a mate who is doing an A-level project, as am I! i was wondering if anyone knows a simple way of putting a picture box in a report which displays the...
1
by: dennemandergal | last post by:
Hi VB.NET I’ve made a object with some text properties and a image property. Private _Billede As Image Public Property Billede() As Image Get Return _Billede ...
1
by: michael Swan | last post by:
Hello and thanks in advance for any help. I have a report that i'd like to display an Image for each record. But not all records have an image. The problem I have is that the last image is then...
4
by: Al Akers | last post by:
I have a problem of changing the placement of an embedded image for a report/print. The initial left measurement of the image format is set to 0. I desire to move the image to the right during a...
1
by: Cindy Rouse | last post by:
I have an access report that includes a picture as a background image (watermark). I need to program the report to print the background image only if one condition is true. Does anyone know how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.