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

OLE field error: Method or data member not found

Status
Not open for further replies.

ptpaton

IS-IT--Management
Apr 22, 2003
124
US
Hi all,

I'm banging my head against the wall on this one. I'm using code provided by Microsoft Knowledge Base to import OLE objects from a folder. I'm trying to import photos from a CF card into Access so that they can be renamed, grouped etc...

I've tried directly setting an OLE field equal to the path in VBA, and the file imports as "long binary data". However, when I try to open the link by double clicking, I run into the "Cannot connect to OLE server" error. Microsoft credits this error to Norton Antivirus 200X script blocking. However, neither Microsoft nor Symantec provides information for disabling script blocking in Synamtec Antivirus Corporate Edition.

In any event, I don't believe that this is a Norton Antivirus error, because after right clicking on the OLE field and manually inserting an OLE object, double clicking the link works fine.

The difference between the methods is that importing creates a OLE class of "long binary" and manually creates a class "Microsoft Photo Editor 3.0".

So, I'm trying to use the code from Microsoft to bring the photos into Access as OLE class "Paint" or "Microsoft Photo Editor 3.0." However, when I run the code below, I get the Method not found error.

Here's the code:
Private Sub Command4_Click()
Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub

SearchFolder, SearchExtension and OLEClass are all unbound text boxes on form frmPhotos.

OLEPath and OLEFile are fields in table tblTempPhotos.

I know that the path and filenames are ok, because I've popped up message boxes verifying that the right paths and filenames are coming through.

When I run this code, I get the Method or data member not found error. I'm guessing that I need to load an OLE reference, but I can't figure out which one. Here are my references (I've checked a lot to try and grab the right one. If something's conflicting, please let me know):

Visual Basic for Apps
Access 10.0 Object Lib
OLE Automation
DAO 3.6 object Lib
VBA for Applications extensibility
Outlook 10.0 Object Lib
Outlook view control
AciveX Data Objects
Photo ActiveX Control module
Adobe Photoshop 7.0 type lib
OLE DB Provider for OLAP Services
OLE DB Service Component 1.0 Type Library
ActiveX Data Objects 2.7 Lib
ActiveX Data Objects RecordSet 2.7 Lib
ActiveX Plugin
OLE DB Error Lib
ADO Ext 2.7 for DDL and security

Thanks in advance for your help. As you can probably guess, I've been trying to find the answer for this all day!



-Patrick

Nine times out of ten, the simplest solution is the best one.
 
Oops..I forgot to mention one thing...

The debugger highlights the [OLEFile].Class = [OLEClass]

That's why I'm guessing that I need some kind of OLE reference.

Thanks

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top