A QueryDefs collection contains all QueryDef objects of a Database object in a Microsoft Jet database, and all QueryDef objects of a Connection object in an ODBCDirect workspace.
Remarks
To create a new QueryDef 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 QueryDef object to a non–zero-length string, you will create a permanent QueryDef 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 QueryDef object.
In an ODBCDirect workspace, a QueryDef is always temporary. The QueryDefs collection contains all open QueryDef objects. When a QueryDef is closed, it is automatically removed from the QueryDefs collection.
To refer to a QueryDef object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:
QueryDefs(0)
QueryDefs("name")
QueryDefs![name]
You can refer to temporary QueryDef objects only by the object variables that you have assigned to them.