URGENT PLEASE : inserting pictures from a DataBase into a data report

JonasBand
JonasBand used Ask the Experts™
on
I have a VISUAL BASIC application where, in an ACCESS database file I have pointers to pictures (either bmp or jpg files). I need to write a report where, beside other data presented in each record, I have also to print the picture. Can somebody help me on how to do that? Is there any way that i can access a data report image control at run time, and set its PICTURE property ? That would solve the problem (I think). Thank you for your enormous help !
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Step 1 load the pciture into a pictrue box, I assume you can do this.

Step 2 print the picture:

Printer.PaintPictrue picExample DX,DY[,DW.DH,SX,SY,SW,SH,rop]

Where D,S = destination/source coordinates.

And rop is a raster operation:

ROP = RasterOpConstants.xxxx ' choose one

You can use the raster op. so overlay images.

In you case you just need to specify the destination

DX = 1440 * 1 ' 1 inch from left
DY = 1440 * 2 ' 2 inches from top

Printer.PaintPictrue picExample DX,DY


Furthermore, when you load your picture you need to set picExample.AutoSize = True

When you print you may wish to reduce/enlarge the size.  You can do this but it is a good idea to maintain aspect ratio. To maintain aspect ratio after you load your pic. stove the orriginal width an height:

sh = picExample.Height
sw = picExample.Width

So on your page you may wish to allocate 2 inches square to accomodate the picture.

So we need to find which measurement is largest, width or height.

If SW>SH then
   NewWidth = 1440 * 2 ' 2 inches wide
   NewHeight = NewWidth * SH/SW ' maintain aspect relativ to width
Else
   NewHeight = 1440 * 2 ' 2 inches high
   NewWidtht = NewHeight * SW/SH ' maintain aspect relative to height
End If

' Now expand/reduce picture to fit into required size

Printer.PaintPictrue picExample DX, DY, NewWidth, NewHeight


You can also use the PaintPicture method on a form or picture box.

Author

Commented:
Hi Inthedark !
 Thank you for your prompt response, but I think I did not explain correctly what I need. I actually have a report formatted (I used a Data Report) with the data I get from each record in the Database (for instance these are Workers data), and i have to include the person´s picture in the report also. The report will look something like :

   _________________________________________________
  x                                                  x
  x  Worker data zzzzzzzzzzzzzzz                     x
  x  More data zzzzzzzzz zzzzzzzzzz zz               x
  x                                                  x
  x                                __________        x
  x  data zzzzz zzzzzz zzzz       x          x       x
  x                               x          x       x
  x                               x  Photo   x       x
  x                               x          x       x
  x data zzzzzzzzzz zzzzzzzzzz    x          x       x
  x                                __________        x
  x _________________________________________________x
 
 This format will be repeated for each worker. I could probably print 3 or 4 per page. The area above marked as Photo is where i need to insert the picture. Can you still help me with that ?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Sorry I don't use DataReport.
Author of the Year 2009

Commented:
Hi JonasBand,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

JonasBand, Please DO NOT accept THIS comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial