Displaying gif images in a report

D

DaveF

I have an Access 2003 database and I would like to display images in a
report based on the value in a datafield.

For example, I have a field in a table called "photo" that contains values
like "photo01.gif." These names tie to gif files located in a folder called
"C:\images."

I would like to set the report to point to the image folder and retrieve and
display the image for each record as the report is processed.

Is this possible?

I tried to work with the image control and OLEbound control but there does
not seem to be a way to configure them to accept the default file location
path and file name for displaying external iamge files..

Do the images need to be stored in the database? Is there another way to
approach this?
 
M

Maarkr

I would add a 'Pic' text field (use 250 as length in case you have long path
names) in the table that includes the full path and filename of the image,
then use that as the source in the report using an image control. Don't use
the Wizard when you add the image control and don't assign an image to it
when u build it... just add the Pic field as the control source.
 
D

DaveF

Thanks Maarkr.

But I see no control source for the image control in the property sheet.

There is a name property and a picture property for the file path and image
name but this must be hardcoded at design time. IOW I must specify the file
path and name when I am creating the report; I cannot dynamically assign
these attributes from the "Pic" field as my report renders.

Is there another type of control I should be using?
 
R

Rob Parker

DaveF said:
Thanks Maarkr.

But I see no control source for the image control in the property
sheet.
There is a name property and a picture property for the file path and
image name but this must be hardcoded at design time. IOW I must
specify the file path and name when I am creating the report; I
cannot dynamically assign these attributes from the "Pic" field as my
report renders.
Is there another type of control I should be using?
 
R

Rob Parker

Sorry for previous empty message, clicked on the wrong button too soon ...

You can set the Picture property for an image control at run time in the
Format event of the section of the report where the Image control is
located. Here's a sample of code, cut/pasted directly from an application
of mine:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Last edited: Rob Parker, 16 Mar 2006

On Error GoTo Detail_Format_Error

DoCmd.SetWarnings False
Me.txtMissing.Visible = False
If Not IsNull(Me!RegionFigure) Then
Me.imgRegionFigure.Picture = Me!RegionFigure
Me.imgRegionFigure.Visible = True
Else
Me.imgRegionFigure.Picture = ""
Me.imgRegionFigure.Visible = False
End If
DoCmd.SetWarnings True

ExitPoint:
Exit Sub

Detail_Format_Error:
If Err.Number = 2220 Then 'picture file not found
Me.imgRegionFigure.Picture = ""
Me.imgRegionFigure.Visible = False
Me.txtMissing.Visible = True 'show textbox with message re missing
picture
Else
MsgBox "Error " & Err.Number & " - " & Err.Description & vbCrLf & _
"in procedure Detail_Format" & vbCrLf & "of VBA Document
Report_sbrptRegionFigure"
End If
Resume ExitPoint
Resume 'Allows control-break to enter debug, and find statement causing
error
End Sub


HTH,

Rob
 
S

srikannan

Contact your Hosting provider.. then want to share this matter with
you.. Then i got my domain name as an international one with free
hosting srevices from this site 'TuckTail.com : Search, Register and
Transfer Web Domain Names and More' (http://www.tucktail.com/) got @
lowest costs only. Also they giving me the good services and also free
too like, • FREE Photo Album • FREE! Quick Blogcast • FREE! Hosting with
Site Builder • FREE! Personalized Email • FREE! Forwarding / Masking •
FREE! 100-Pack Email Forwarding • FREE! Starter Web Page • FREE! "For
Sale" Parked Page • FREE! Parked Page w/ Domain • FREE! Total DNS
Control • FREE! Change of Registration • FREE! Status Alerts • FREE!
Domain Name Locking
 

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