ACC1x: Cannot Auto Update an OLE-Linked Object in a TableLast reviewed: June 3, 1997Article ID: Q101320 |
The information in this article applies to:
SYMPTOMSThe Auto Update check box is unavailable in the Edit Paste Special dialog box when you are attempting to paste link an OLE object.
CAUSEYou cannot paste link an object into an OLE-object field in a table in Microsoft Access and specify that the link be "hot," or automatically updated. You can place linked OLE objects on forms and reports when they are in Design view. If you paste a link to an OLE object into a form or report in Design view, the Auto Update check box will be available.
RESOLUTIONOne workaround is to force Microsoft Access to update the OLE-linked field by selecting the object to update, choosing Object from the Edit menu, and then selecting Update. This process can be automated using the Access Basic UpdateOLE() function listed below, which can be assigned to a button on the form or to the OnCurrent property of the form. If it is assigned to the OnCurrent property, Microsoft Access will automatically perform the macro whenever you select a different record. This will ensure that the data in the selected record will always be current, effectively simulating auto updating. Create a new module with the following declarations and UpdateOLE() function:
'**************************************************************** ' DECLARATIONS SECTION '**************************************************************** Option Explicit '**************************************************************** ' FUNCTION: UpdateOLE ' ' PURPOSE: Automates updating an OLE-linked field. ' ' ARGUMENTS: ' FieldName - A string with the name of the field to update. ' ' EXAMPLE USAGE: ' The OnPush property for a button could be set to: ' =UpdateOLE("OLEField") ' ' SIDE EFFECTS: ' Focus will be left on the OLE-object field. ' The record will be put in Edit Mode. ' '**************************************************************** Function UpdateOLE (ByVal FieldName As String) On Error GoTo ErrUpdateOLE DoCmd GoToControl FieldName DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_OBJECT, A_OBJECTUPDATE ByeUpdateOLE: Exit Function ErrUpdateOLE: Resume ByeUpdateOLE End Function Using the UpdateOLE() FunctionYou can use the UpdateOLE() function by assigning it to a button on the form or to the OnCurrent property of the form. If performance is a problem when you are using the OnCurrent solution, the button approach allows you to decide when the data should be refreshed. For a linked OLE field named "OLEField" on your form, set the OnPush property of the button or the OnCurrent property for the form to the following:
=UpdateOLE("OLEField")If you have multiple OLE-linked fields you can create a macro to call UpdateOLE() for each OLE field on the form. For three linked OLE fields on a form named "OLEField1", "OLEField2", and "OLEField3", create the following macro and save it with the name "UpdateAllOLEFields"
Action Argument ------------------------------------------------------- RunCode Function Name: =UpdateOLE("OLEField1") RunCode Function Name: =UpdateOLE("OLEField2") RunCode Function Name: =UpdateOLE("OLEField3")then set the OnPush property of the button or the OnCurrent property of the form to the following:
UpdateALLOLEFields STATUSThis problem no longer occurs in Microsoft Access version 2.0.
MORE INFORMATIONHot linking, or automatically updating an OLE object, requires a significant number of system resources. Large numbers of hot-linked OLE linked objects can cause out of memory or other system errors. However, Auto Update is available to unbound OLE objects inserted in a form or report in Design view. This is because the number of objects inserted in a form is generally minimal.
Steps to Reproduce Behavior
|
Additional query words: greyed grayed dimmed checkbox
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |