QueryDefs Collection

    Example    Methods    Properties

A QueryDefs collection contains all CdbQueryDef objects of a CdbDatabase object in a Microsoft Jet database, and all CdbQueryDef objects of a CdbConnection object in an ODBCDirect workspace.






Remarks

To create a new CdbQueryDef object, use the CreateQueryDef method. In a Microsoft Jet workspace, if you supply a string for the name argument or if you explicitly set the Name property of the new CdbQueryDef object to a non–zero-length string, you will create a permanent CdbQueryDef that will automatically be appended to the QueryDefs collection and saved to disk. Supplying a zero-length string as the name argument or explicitly setting the Name property to a zero-length string will result in a temporary CdbQueryDef object.

In an ODBCDirect workspace, a CdbQueryDef is always temporary. The QueryDefs collection contains all open CdbQueryDef objects. When a CdbQueryDef is closed, it is automatically removed from the QueryDefs collection.

To refer to a CdbQueryDef object in a collection by its ordinal number or by its Name property setting, use either of the following syntax forms:

QueryDefs[0]

QueryDefs["name"]

You can refer to temporary CdbQueryDef objects only by the object variables that you have assigned to them.