SourceObject Property

Applies To

Subform/Subreport Control, Unbound Object Frame Control.

Description

You can use the SourceObject property to identify the form or report that is the source of the subform or subreport on a form or report. You can also use this property for linked unbound object frames to determine the complete path and filename of the file that contains the data linked to the object frame.

Setting

Enter the name of the form or report that is the source of the subform or subreport in the control’s property sheet. If you add a subform or subreport to the form or report by dragging it from the Database window, the SourceObject property is set automatically in the property sheet.

For unbound object frames, the SourceObject property is set automatically when you use the Object command on the Insert menu to insert a linked OLE object.

For a subform or subreport, you can set this property using the control’s property sheet, a macro, or Visual Basic.

In Visual Basic, you set this property using a string expression that is a name of a form or report.

For linked unbound object frames, the SourceObject property can’t be set in any view.

Note You can’t set or change the SourceObject property in the Open or Format events of a report.

Remarks

If you delete the SourceObject property setting in the property sheet for a subform or subreport, the control remains on the form but is no longer bound to the source form or report.

See Also

LinkChildFields, LinkMasterFields Properties; Parent Property.

Example

The following example displays the name of the form that is the source of the Product List subform control in the Debug window.


Debug.Print Forms![Categories]![Product List].SourceObject