Access 2000 code won't compile w/ 2003

J

Joe

Microsoft has a tutorial "How to Load OLE Objects from a Folder into a Table"
at http://support.microsoft.com/?kbid=198466

In this, the following code won't compile:

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 = [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

The problem are the following lines:

[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed

DoCmd.RunCommand acCmdRecordsGoToNew

Are there different commands in Access 2003 for storing an OLE file in the
'OLEFile' column for a new record? (rather than .class, .sourcedoc, etc.)

And what would be the 2003 command for going to the new record of a table?

Thanks in advance,
Joe
 
J

Joe

The error message I am getting is:

<Method or data member not found>
highlights: ".Class ="

I think the issue may not be that the commands are different, but rather its
not correctly locating the new record and column 'OLEFile' in the table
'tblLoadOLE' which is linked to the form.

Anyone have any ideas?
 
K

Klatuu

This is a VBA reference problem. The 2003 Object libraries are different
from the 2000 version.
 

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