A reference to a DataModule object.

Syntax

[<oRef> =] new DataModRef( )

<oRef>

A variable or property—typically of a Form or Report object—in which to store a reference to the newly created DataModRef object.

Properties

The following table lists the properties of the DataModRef class. (No events or methods are associated with this class.) For details on each property, click on the property below.

Property

Default

Description

active

false

Whether the referenced dataModule is active

baseClassName

DATAMODREF

Identifies the object as an instance of the DataModule class

className

(DATAMODREF)

Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName

dataModClass

 

The class name of the dataModule

filename

 

The name of the file containing the dataModule class

parent

null

Container, form or report

ref

null

A reference to the dataModule object

share

None

How to share the dataModule

Description

A DataModRef object is used to access dataModules. The filename property is set to the .DMD file that contains the dataModule class definition. The dataModClass property is set to the class name of the desired dataModule. Then the active property is set to true to activate the dataModule.

If the share property is All instead of None, any existing instance of the desired dataModule class is used. Otherwise a new instance is created. A reference to the dataModule is assigned to the ref property.

When a DataModRef object is activated in the Form designer, the dataModule object’s rowset property is assigned to the form’s rowset property. Therefore you can access the form’s primary rowset, and all other rowsets relative to it, in the same way whether you’re using a dataModule or not. To reference the queries in the dataModule from the form, you have to go through two additional levels of objects. For example, instead of:

form.query1.rowset

you would have to use:

form.dataModRef1.ref.query1.rowset

However, if query1.rowset was the primary rowset of the dataModule, you would still use:

form.rowset

anyway, and in query1.rowset’s event handlers, you would still use:

this.parent.parent.query2.rowset

to access query2.rowset whether you’re using a dataModule or not, because the two Query objects are in the same relative position in the object containership hierarchy.