I would like to open a form that shows a word document (or preferably a thumbnail of a word document) in an object frame.
The document(s) displayed would need to change based on information on the form, or sent to the form when opened. I would strongly prefer this to be an unbound frame since storing tens of thousands of Word documents in the database would be a major hassle.
I've been playing around with the following code trying to get off on the right foot. It creates a new form based on information found in a text box on the current form, but it throws an error on the acOLECreateLink line saying that the unbound object frame on the new form doesn't contain and OLE object.
Any suggestions? Thanks!
Dim varSource As String
Dim OLE1 As Object
Dim control1 As Control
Dim frm As Form
varsource = [file path]
Set frm = CreateForm
Set OLE1 = CreateControl(frm.Name, acObjectFrame, , , , 500, 500)
OLE1.Class = "Word.Document" ' Set class name.
' Specify type of object.
OLE1.OLETypeAllowed = acOLELinked
' Specify source file.
OLE1.SourceDoc = varSource
' Create linked object.
OLE1.Action = acOLECreateLink
DoCmd.Restore
The document(s) displayed would need to change based on information on the form, or sent to the form when opened. I would strongly prefer this to be an unbound frame since storing tens of thousands of Word documents in the database would be a major hassle.
I've been playing around with the following code trying to get off on the right foot. It creates a new form based on information found in a text box on the current form, but it throws an error on the acOLECreateLink line saying that the unbound object frame on the new form doesn't contain and OLE object.
Any suggestions? Thanks!
Dim varSource As String
Dim OLE1 As Object
Dim control1 As Control
Dim frm As Form
varsource = [file path]
Set frm = CreateForm
Set OLE1 = CreateControl(frm.Name, acObjectFrame, , , , 500, 500)
OLE1.Class = "Word.Document" ' Set class name.
' Specify type of object.
OLE1.OLETypeAllowed = acOLELinked
' Specify source file.
OLE1.SourceDoc = varSource
' Create linked object.
OLE1.Action = acOLECreateLink
DoCmd.Restore