G
Guest
I need help in geting my report to update its unbound object frame which is
linked to an excel spreadsheet using VBA Code.
I followed the suggestions in Knowledge Article # 311147 (How to
Programmatically change the Paths to Linked OLE Objects) and Article # 202174.
I have created a unbound object frame on a Form and set the Enabled and
Locked properties on the form to Yes and No respectively. I also created the
Form as a subform and placed it on a Report. On the report, I have the
following VBA Code:
Function UpdateOLE(PlayNo As Integer, NewPath As String)
Dim myForm As Form
Dim z As String
z = Trim(Str(PlayNo))
'Open the form if it is not already open.
DoCmd.OpenForm "Drawings", acNormal, , , acFormEdit
'Bring the form to the front if it is currently behind other objects.
DoCmd.SelectObject acForm, "Drawings"
With Forms![Drawings]![OLEUnbound4]
.Enabled = True
.Locked = False
.OLETypeAllowed = acOLELinked
.Class = "Excel.Sheet"
.SourceDoc = NewPath
.SourceItem = "Play# " & z & "!Print_Area"
.Action = acOLECreateLink
.SizeMode = acOLESizeClip
End With
End Function
When I preview my report, the Form Drawings is updated with the latest link.
The report doesn't update immediately until I exit the Access and open it up
again.
I have a special drawing for record 1, 2, 3 and 4 which is updated on the
Form. I want the report to show the linked image on the Unbound Object Frame
as I print the Report. I want to get 4 pages for the 4 unqiue records. I
will have a Table with 4 items (number 1 to 4).
I see the correct information on the Form, but its not updating the Report.
Can someone please help!
Thanks,
Gary
linked to an excel spreadsheet using VBA Code.
I followed the suggestions in Knowledge Article # 311147 (How to
Programmatically change the Paths to Linked OLE Objects) and Article # 202174.
I have created a unbound object frame on a Form and set the Enabled and
Locked properties on the form to Yes and No respectively. I also created the
Form as a subform and placed it on a Report. On the report, I have the
following VBA Code:
Function UpdateOLE(PlayNo As Integer, NewPath As String)
Dim myForm As Form
Dim z As String
z = Trim(Str(PlayNo))
'Open the form if it is not already open.
DoCmd.OpenForm "Drawings", acNormal, , , acFormEdit
'Bring the form to the front if it is currently behind other objects.
DoCmd.SelectObject acForm, "Drawings"
With Forms![Drawings]![OLEUnbound4]
.Enabled = True
.Locked = False
.OLETypeAllowed = acOLELinked
.Class = "Excel.Sheet"
.SourceDoc = NewPath
.SourceItem = "Play# " & z & "!Print_Area"
.Action = acOLECreateLink
.SizeMode = acOLESizeClip
End With
End Function
When I preview my report, the Form Drawings is updated with the latest link.
The report doesn't update immediately until I exit the Access and open it up
again.
I have a special drawing for record 1, 2, 3 and 4 which is updated on the
Form. I want the report to show the linked image on the Unbound Object Frame
as I print the Report. I want to get 4 pages for the 4 unqiue records. I
will have a Table with 4 items (number 1 to 4).
I see the correct information on the Form, but its not updating the Report.
Can someone please help!
Thanks,
Gary