Brian,
 
    With Pic as the name of bound OLE control on the form and Path as the name of control holding full path of image file, the following set of statements in form's code module should suffice.
 
        Pic.SourceDoc = Path
        Pic.Action = "">

    Note - If linked image is desired, use acOLECreateLink instead of acOLECreateEmbed
 
    As the path for image file is already available with you, the preferred alternative would be to eliminate the OLE field from your table altogether, in order to prevent unnecessary bloating of your db.
 
    Instead, you can place an image control in report's detail section and assign the file path to its picture property via print event (of detail section). DO NOT USE THE FORMAT EVENT FOR THIS PURPOSE.
 
Best wishes,
A.D.Tejpal
 
ps: Just for academic interest, your existing SendKeys commands should work successfully, if lower-case key names are used (e.g.  f, e, v  instead of  F, E, V). But you should no longer be needing any of this.
 
----- Original Message -----
Sent: Monday, October 03, 2005 18:48
Subject: [AccessDevelopers] Insert Object from file with code.

Second request for help.  Does anyone know some code to insert an object from a file?  I have the path I want to insert in the same record.


I have an application that goes through a list of Part #'s and inserts the Digital Picture into a table for each part for printing.

I know its not best practices so don't yell at me for doing it, but I
did the best I could at the time. I had been using a macro with the following;

GotoControl -> Path
RunCommand -> Copy
GotoControl ->Pic
Runcommand -> Insert Object
SendKeys -> %F%E^V{Enter}
GoToRecord->Next

This macro was being called by a function in a module that was looping through once for each part.

It had worked well until recently, we had a problem with the PC that was running the process each night and rebuilt it with a newer one.
Now it hangs at the Send Keys command after the Insert Object Dialog is opened.

My goal is to do the equivalent of;
Insert Object
Create from File
Paste the file name from the clipboard or use the file name contained in the field "Path" for the current record.

Can somebody help me with the proper code to do this?

Thanks,

Brian Stenglein



Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to