Inserting an OLE Object?

Posted on 2003-02-23
Medium Priority
Last Modified: 2012-06-27
I need to know how to insert an OLE Object into access? But I need to know how to do it with an SQL statement so I can write it using ASP. My webpage already has the upload input field for uploading the files.
Question by:Ristogod
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 58
ID: 8004258
  You can't do it with straight SQL.  To insert an OLE object, you need to do it via a form.

  You really don't want to do this anyway's, as Access adds its own wrapper to the object, which makes the database bloat considerably.

  Your best bet is to simply leave the object in its own file and access it as needed.

  If you really want to store it in the MDB, you can write directly to a memo field, but then you'll need to extract it to a file before you can work with it.  Without the wrapper Access won't know how to handle the field.

LVL 26

Accepted Solution

Alan Warren earned 80 total points
ID: 8005410

You wont have any control over the uploaded file untill it resides on the server.

Then to put it in a field using asp you will need to do a BinaryRead

Private mbBinaryData
Private mnTotalBytes
mnTotalBytes = Request.TotalBytes
mbBinaryData = Request.BinaryRead(mnTotalBytes)

  Set mrsApply = Server.CreateObject("ADODB.Recordset")

  With mrsApply
   .CursorLocation = adUseClient
   .CursorType = adOpenStatic
   .LockType = adLockOptimistic
  End With

  With mrsApply.Fields

   .Append "FormBinary", adLongVarBinary, 1048576, adFldMayBeNull + adFldLong
   .Fields("FormBinary").Value = mbBinaryData
  End With


Regards Alan

Author Comment

ID: 8009120
Thnx Alan

Wow? I'm just learning ASP and boy does that seem confusing. I don't think that I understand what that all means.

Another thing, how do I get the file to the server through a webpage? I want people to be able to submit papers online and have them stored in my Access DB.
LVL 26

Expert Comment

by:Alan Warren
ID: 8012875

What stage are you up to with the upload file?
Has the user selected a file for upload?
Is the upload control within a <form> tag?
Have you posted the form to the server?

There is a bit involved with getting the upload file to the server, but once it is there the formData can be parsed and the file can be extracted from the the formBinary and reconstructed as a file.

Hang in there!
There is never any shortage of stuff to get your head around.

Good Resource:(Sample Code)

LVL 18

Expert Comment

ID: 8717459
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, points to alanwarren
Please leave any comments here within the next seven days.
EE Cleanup Volunteer

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question