QueryDef Object

See AlsovbobjQueryDefSee              PropertiesvbobjQueryDefProp           MethodsvbobjQueryDefMth


A definition of a query stored in a database.


You can use the name of an existing QueryDef in the RecordSource property of a data control just as you would use the name of a Table to define the records in the control's Dynaset.

The default property of a QueryDef object is the Name property.

Professional Edition

In the Professional Edition, you can create an object variableZ3R9Q5 of type QueryDef.  When you create a Dynaset or Snapshot using an SQL query29F05E5, the query is stored in your code.  Instead of repeatedly creating often-used queries in code, you can use the CreateQueryDef method to create a QueryDef that is saved in the Database.

Like a Table, a QueryDef has a name recognized by the Database.  The name of a QueryDef is not the same as the name of an object variable to which it has been assigned.  Unlike controls and forms, the Name property of a QueryDef object is available at run time.

The TableDefs collection of a Database also lists available QueryDefs.  To discover whether a listed TableDef is really a QueryDef, use the ListTables method.