Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Picture in Report - HOW?

Status
Not open for further replies.

kjedwards

Programmer
Feb 14, 2002
12
GB
Hi

I am very new to Access and need some help - please!

I have written a query to extract data from a database and I want to use this in a report.

One field is called id and holds a unique member id

On my hard drive I have a directory c:\members\pics in which I hold pictures of the members ie 1234.jpg

I want to print the picture of each member in a report which outputs details of several members according to the search criteria defined in the query

I have tried the bound object frame and entered the path in the Source Item property ie "c:\members\pics\ " & ME![id} & ".jpg"

But it just doesn't work when I run a print preview.

I have tried several variations on the above (ie ie "c:\members\pics\ " & [id} & ".jpg")

I have tried with Control Source left black and also set to id

Nothing works!

Can anyone help?

Thanks

Kevin
 
Hi Kevin,

You can add an image control to the report. When it prompts you for a graphic file just choose any (You will change it with the location of your photos).

Put an event procedure in the 'On Format' part of the Page Header. (Right click on the page header, show properties click the 3 dots command button after clicking once in the on format element.)

Name the text box that contains the unique number id something like txtID.

The code should be...

Image1.Picture = "C:\members\pics\" & txtID.text & ".jpg"

If you have the picture in the detail section change the location of where you run the code.

Hope this helps

Nick
 
Hi

I tried something like this and it didn't work.

I have now tried -

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

Me!Pic.Picture = "c:\members\pics\" & Me![id] & ".jpg"

End Sub

Where Pic is an image object

This seems to work ok, except in Print Preview some records don't get shown at all - other show ok.

As an aside, does anyone know how to return a set number of records?

My database has about 4000 records. The search criteria is returning about 500 records. Is there any way to limit the number of records returned ie 1-100, 101-200 etc

Thanks

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top