Run-time error 2777

  • Thread starter Bayou_Bob via AccessMonster.com
  • Start date
B

Bayou_Bob via AccessMonster.com

I'm attempting to follow instructions from an article entitled "How to Load
OLE Objects from a Folder into a Table". I created a table "tblLoadOLE" with
the following three fields:
OLEID - AutoNumber
OLEPath - Text
OLEFile - OLE Object

I created a form with a command button with the associated event procedure:

Private Sub cmdLoadOLE_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 = [OLEPath]
[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

When I try to execute the command in the Form view, I get the following error
message:

Run-time error '2777'
The class argument in the CreateObject function of the Visual Basic procedure
you're trying to run is invalid.

Try one of the following:
* Make sure the file is installed on you computer and that you used the
correct file name.
* Check the OLE server's documentation for information about the syntax to
use when specifying an OLE object's data.

I'm using ACCESS 97.

Any ideas what may be going wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top