Improting multiple OLE Obejcts problem

Joined
Mar 2, 2011
Messages
1
Reaction score
0
Hi,

I have a problem with VB code that's supposed to import multiple files from choosen folder into a database.

Problem is that when i use "[OLEFile].Action = acOLECreateLink" instead of "acOLECreateEmbed"

later it crash on :

DoCmd.RunCommand acCmdRecordsGoToNew

but when i use "acOLECreateEmbed" it works fine, yet i want to only put links to those files not a whole files.


Here's the code:


Option Compare Database

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

MyPath = MyFolder & "\" & "*." & [SearchExtension]

MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLELinked
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].DisplayType = acOLEDisplayIcon
[OLEFile].Action = acOLECreateLink



MyFile = Dir

DoCmd.RunCommand acCmdRecordsGoToNew
Loop




End Sub



Thanks for any advice how to solve it.

A.
 
Back
Top