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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting multple OLE images into a table at once not individually 2

Status
Not open for further replies.

keithvp

Instructor
Aug 10, 2000
19
US
I have several portrait images that I need to insert into a table OLE field.&nbsp;&nbsp;How would I go about setting up Access to insert all of the images at once instead of having to insert each image into the OLE field one at a time?&nbsp;&nbsp;I have too many images to do it manually.<br><br>Thanks for the help, Keith&nbsp;&nbsp;<br><br><br><br>&nbsp;<br>&nbsp;<br>
 
Are the images in a directory by themselves, or do they all have a distinctive name, like imageXXX?<br><br>If so, you could open the table as a recordset, and use the addnew command to insert the image.<br><br>You can get the images one by one by using the Dir command.<br><br>Something like this<br><br><br>***Begin Code Snippet***<br>dim strImageFileName as string<br>dim rstImage as recordset<br><br>set rstImage = currentdb.OpenRecordset(&quot;YourTableName&quot;)<br><br>strImageFileName = Dir(&quot;Yourfullpath&quot;)<br>do until strimagefile=&quot;&quot;<br>&nbsp;&nbsp;rstImage.addnew<br>&nbsp;&nbsp;rstImage!YourOLEField = strImageFile<br>&nbsp;&nbsp;rstImage.Update<br>&nbsp;&nbsp;strimagefile = Dir<br>loop<br><br>***End Code Snippet<br><br>HTH, <p>Kathryn<br><a href=mailto: > </a><br><a href= > </a><br>
 
Hi,

I Recommend you to View your Image instead of Load it to your table, other wise you'll get Invalid Argument later.
You can Insert ActivX to load your Image as view only.
If you intrest that let me know so i can help you more cause i did a programe for Image Archiving such as you need.

Good Luck
 
Guys, I've got similar problem here. What I did was a database in which I hold some detailed info of patients of mine. When the need arised I've put pictures of those people. But the problem appeared when multi-pictures of the same persons need to be included in the same database. Is there a practical way to browse the harddisk and add pictures of the same person into his database?

Thanks...
 
first of all name the image files uniquely to have some relation with the unique Id of your records.
secondly, copy all the images into one directory.
then you can use
recordset object to add each picture in code to respective record
use this code with the click event of a button
code segment
dim rs as adodb.recordset
dim cnn as adodb.connection
open the connection
open recordset
rs.movefirst
use the unique filed to composethe file name of image file
and append the image using the file to the appropriate image field
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top