View Full Version : Include pictures as a result of query


wdenboer
04-07-2010, 05:57 AM
Hello all,

For a database project I am looking for some code which enable me to create a report which includes pictures from a query.

The query is called; "Query report FST" and the result in the query is a link to a file location. f.e. 'c:\my documents'. The column which should be displayed is called 'FileName'

The report should display the picture and not the location.

Somehow the report is only displaying the storage location.

How can I make the picture shown in the report. either in VBA or just on the from.

thanks in advance:D

Trevor G
04-08-2010, 12:10 AM
Have you got a field in the table that is using OLE as the data Type as this will retain the picture then it should be displayed on a form or report, but not in the table or query.

wdenboer
04-08-2010, 01:45 AM
Hi Trevor G,

No in the table the file location has been stored.

But today I noted the first problem with this approach. When using an USB stick for storing the database the path cab change from F:\ to H:\, and than the file locations are wrong.

is there a way to make the storage location variable to the USB path, or what should I change to make the OLE solution work.

I will attach the basics of my data base so you can see what I did sofar. on the report page 'Picture_page' the pictures listed in table 'comments' should be shown.

I hope someone is willing to help me out.

Kind regards

Wouter

Simon_MT
04-08-2010, 09:17 AM
I would suggest that you create a directory on the C Drive [Databases] and underneath that put an Image Directory.

Simon

highandwild
04-08-2010, 01:46 PM
You could provide a dialog box to select the drive that the correct files are on and then check to see if the correct files are on that drive.

An extra step I know but quick to set up if storing the files on the USb stick is essential.

highandwild
04-08-2010, 01:55 PM
Maybe you could use this code from Microsoft:

http://support.microsoft.com/kb/180766 (http://support.microsoft.com/kb/180766)

and then instead of looking for the CDROM Drive look for the
removable drive using the removable drive type constant as detailed on this other page.

http://msdn.microsoft.com/en-us/library/system.io.drivetype.aspx (http://msdn.microsoft.com/en-us/library/system.io.drivetype.aspx)

I’ll play around with those sometime as it’s all new to me.