View Single Post
  #41 (permalink)  
Old 08-27-07, 20:52
Brent Blevins Brent Blevins is offline
Registered User
 
Join Date: Jun 2007
Posts: 65
Programaticaly Embed or Link a file in an OLE File field

While this isn't rocket science, I have posted several times asking folks how to programaticaly embed a file into an OLE field from a form. I did not get any workable solutions. I am not sure if it is because I am the only one with a need to do this or if it is that no one knew how. So, after much digging and experimenting, I present to you a working solution if you have this need.

Important note:
Whether you are planning to Embed or Link the file, the "OLE Type Allowed" MUST be set to either for the Bound Object Frame.

The database consists of a form that opens when you open the database. When you click the "Attach File" button, a TextBox and a Bound Object Frame are displayed. The standard Windows File Open Dialog Box displays with a caption of "Select File to Attach!". The caption can be changed to suit your taste. Once a file is selected, it will be embedded or linked. The code currently Embeds the file. In order to Link the file (usefull for graphics files, comment out the Embed line and uncomment the Link line in the code.

I hope this is helpful to someone.


Enjoy,
Brent Blevins
Attached Files
File Type: zip OLE Insert.zip (38.3 KB, 335 views)
Reply With Quote