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.
 

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