Accessing an OLE Object via Web UI 
Author Message
 Accessing an OLE Object via Web UI

Problem: How do I extract a "Word" OLE object from an
MS Access'97 database record and save to a WORD document
file for a user "browsing" into a web site to see the

I inherited an MSAccess database to track test cases
and steps to execute test cases.  The "steps" were written
in WORD and saved in an Access record OLE field.  This
works quite well using Access forms to view and activate
WORD to do the editing.  But, when I want to do online
reports, the WORD document is not accessable to most of
the data access controls that I've found.  What I'd like
to do is use ADO or RDO or even DAO to open the table,
get records, and in particular get the WORD object saved
into a new file and redirect the page to point to the
newly saved document.

My first attempt was using ADO on ASP pages but could
not get the OLE Object into a word object.  Then I tried
to just get it to work with VB 6.0 with code similar
to what follows:

Function GetSteps(sTestId) As Boolean
   Dim obj as Object
   Dim wdObj as WORD.Document
   Dim sql as String
   Dim db as Database
   Dim rs as RecordSet

   ' GetSteps = False is assumed
   ' do stuff to open db (DAO Attempt shown)
   On Error Goto GETERR
   Set db = OpenDatabase("TestCasesDb.mdb")
   sql = "SELECT [Test ID], [Is Document], [Test Procedure] " & _
         "FROM tbl_TestCases WHERE [Test ID]='" & sTestId & "'"
   Set rs = db.OpenRecordset(sql)
   If rs![Is Document] Then
      Set obj = rs![Test Procedure]
      Set wdObj.Document = obj
   End If
   GetSteps = True
   Exit Function
   Debug.Print Err.Description, Err.Number
End Function

What happens is a "Type Mismatch" even if I try to access
the field directly into wdObj.

My current kludge is to use an OLE control on a form,
use the old Data Access control and bind the OLE control
to the data access control.  Setup the data access control
to point to my database and query for the test case I want
and then do:

            Set wdObj = OLE1.object
            OLE1.DoVerb vbOLEOpen
            OLE1.DoVerb vbOLEUIActivate
            wdObj.Application.Visible = False
            wdObj.SaveAs sPath & sName       ' path and name set prior
            wdObj.Close False
            Set wdObj = Nothing

Works great in a standard app!  But need this online.  So
I wrapped an ActiveX control to Shell out the app.  Again, works
fine standalone but when running from the web I get:
   Permission to use object denied
   which is error 419

Then I tried setting write permission to the directory
where the files were going, "Write" access via web to
that same directory an still get the permission failure.

HELP.... There has to be a clean way to do this!

Any pointer to sample code, either on the MSDN library CDs (like
search does any good), or on the web, would be greatly

_______       ______________________________________________________
           /                                             Franc Woods
          /                    Network Peripheral Solutions Division
         ____       ___  /                  Hewlett-Packard, MS:5659
        /     /    /    /                              Roseville, CA
     __/   __/    _____/      /\~/\                     916/785-5065

___________   __/   ______ooO_{>v<}_Ooo_____________________________
                          ```   U   '''

Fri, 02 Nov 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Accessing an OLE Object via Web UI

2. VB30: Accessing OLE-field in ACCESS-DB via OLE-VBX

3. deselect an OLE Object open for edit in UI

4. Copying an OLE object from an Access table to Word via VBA

5. Create Hyperlink, OLE Object Field via Access SQL

6. Access 2.0 Report Objects via OLE Automation?

7. Storing an OLE object into Access OLE access

8. Linking or Embedding an OLE object into an Access OLE DataType Field using DAO

9. Linking or Embedding an OLE Object in an Access OLE DataType Field using DAO

10. Insertion of OLE-Object into OLE-Field of Access-Table

11. storing an OLE object into an Access OLE field

12. Activate OLE object via code


Powered by phpBB® Forum Software