Originally Posted by
OBP
I have never used Attachment fields but I do use code to open existing documents based on their Folder location.
This is the code that I use
On Error GoTo errorcatch
If Me.Document_Type = ".jpg" Or Me.Document_Type = ".jpeg" Or Me.Document_Type = ".gif" Then
Me.test.Class = "Package" ' Set class name.
Me.test.OLETypeAllowed = acOLEEmbedded
Me.test.SourceDoc = Me.Document_Location
Me.test.Action = acOLECreateEmbed
Me.test.SizeMode = acOLESizeZoom
With Me.test
.Action = acOLEActivate
.Verb = acOLEVerbOpen
End With
If Me.Document_Type = ".jpg" Or Me.Document_Type = ".jpeg" Then Me.Include_in_Photo_Catalogue.Visible = True
Exit Sub
End If
If Me.Document_Type = ".pdf" Then
MsgBox "1"
Me.Document_Link.Class = "Package" ' Set class name.
MsgBox "2"
Me.Document_Link.OLETypeAllowed = acOLELinked
MsgBox "3"
Me.Document_Link.SourceDoc = Me![Document Location]
MsgBox "4"
Me.Document_Link.Action = acOLECreateLink
MsgBox "5"
Me.Document_Link.SizeMode = acOLESizeZoom
With Me.Document_Link
.Action = acOLEActivate
.Verb = acOLEVerbOpen
End With
Else
Application.FollowHyperlink Me.Document_Location, , True
End If
Exit Sub
errorcatch:
MsgBox Err.Description
Exit Sub
It is an old Document Management database and may no longer work very well, but you are welcome to a copy.
I am not sure bout opening all of the attachments other than by looping through the fields.