Class QueryDef (DAO VBA)

A QueryDef object is a stored definition of a query in a Microsoft Access database engine database.

The classes Database, Recordset and Recordset2. give access to class QueryDef


Dim qry as QueryDef
Set qry = Workspaces(1).Databases(1).QueryDefs(Item:=1)

Methods

OpenRecordset - Creates a new Recordset object and appends it to the Recordsets collection.

Dim rst As DAO.Recordset
Set rst = qry.OpenRecordset

Cancel - expression .Cancel

Close - Closes an open QueryDef.

CreateProperty - Creates a new user-defined Property object (Microsoft Access workspaces only).

Execute - Executes an SQL statement on the specified object.

Properties

Parameters (Default member) - Returns a Parameters collection that contains all of the Parameter objects of the specified QueryDef.

CacheSize sets or returns the number of records retrieved from an ODBC data source that will be cached locally.

Connect sets or returns a value that provides information about the source of database used in a pass-through query.

DateCreated returns the date and time that an date was created (Microsoft Access workspaces only). Read-only Variant.

Fields returns a Fields collection that represents all stored Field objects for the specified object.

hStmt

LastUpdated returns the date and time of the most recent change made to an date. Read-only Variant.

MaxRecords sets or returns the maximum number of records to return from a query against an ODBC data source.

Name returns or sets the name of the specified object.

ODBCTimeout indicates the number of seconds to wait before a timeout error occurs when a QueryDef is executed on an ODBC database.

Prepare expression .Prepare

Properties returns the Properties collection of the specified object.

RecordsAffected returns the number of records affected by the most recently invoked Execute method.

ReturnsRecords sets or returns a value that indicates whether an SQL pass-through query to an external database returns records (Microsoft Access workspaces only).

SQL sets or returns the SQL statement that defines the query executed by a QueryDef object.

StillExecuting expression .StillExecuting

Type sets or returns a value that indicates the operational type or data type of an object.

Updatable returns a value that indicates whether you can change a DAO object.

Fields - A Fields collection contains all stored Field objects of an Index, QueryDef, Recordset, Relation, or TableDef object.

Parameters - A Parameters collection contains all the Parameter objects of a QueryDef object.

Properties - A Properties collection contains all the Property objects for a specific instance of an object.

Property - A Property object represents a built-in or user-defined characteristic of a DAO object.

Recordset - A Recordset object represents the records in a base table or the records that result from running a query.