Class Database (DAO VBA)

A Database object represents an open database.

The classes DBEngine and Workspace. give access to class Database


Dim db as Database
Set db = Workspaces(1).Databases(Item:=1)

Methods

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


    Dim dbs As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim rst As DAO.Recordset
    
    Set dbs = CurrentDb
    
    'Get the parameter query
    Set qdf = dbs.QueryDefs("qryMyParameterQuery")
    
    'Supply the parameter value
    qdf.Parameters("EnterStartDate") = Date
    qdf.Parameters("EnterEndDate") = Date + 7
    
    'Open a Recordset based on the parameter query
    Set rst = qdf.OpenRecordset()

Close - Closes an open Database.

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

CreateQueryDef - Creates a new QueryDef object.

CreateRelation - Creates a new Relation object (Microsoft Access workspaces only).

CreateTableDef - Creates a new TableDef object (Microsoft Access workspaces only).

Execute - Runs an action query or executes an SQL statement on the specified object.

MakeReplica - Makes a new replica from another database replica (Microsoft Access workspaces only).

NewPassword - Changes the password of an existing Microsoft Access database engine database (Microsoft Access workspaces only).

PopulatePartial - Synchronizes any changes in a partial replica with the full replica, clears all records in the partial replica, and then repopulates the partial replica based on the current replica filters. (Microsoft Access database engine databases only.

Synchronize - Synchronizes two replicas. (Microsoft Access workspaces only).

Properties

TableDefs (Default member) - Returns a TableDefs collection that contains all of the TableDef objects stored in the specified database.

CollatingOrder returns a value that specifies the sequence of the sort order in text for string comparison or sorting (Microsoft Access workspaces only).

Connect sets or returns a value that provides information about the source an open database.

Connection expression .Connection

Containers returns a Containers collection that represents all of the Container objects in the specifed database.

DesignMasterID sets or returns a 16-byte value that uniquely identifies the Design Master in a replica set (Microsoft Access workspaces only).

Name returns the name of the specified object.

Properties returns the Properties collection of the specified object.

QueryDefs returns a QueryDefs collection that contains all of the QueryDef objects of the specified database.

QueryTimeout sets or returns a value that specifies the number of seconds to wait before a timeout error occurs when a query is executed on an ODBC data source.

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

Recordsets returns a Recordsets collection that contains all of the open recordsets in the for the specified database.

Relations returns a Relations collection that contains all of the stored Relation objects for the specified database.

ReplicaID returns a 16-byte value that uniquely identifies a database replica (Microsoft Access workspaces only).

Transactions returns a value that indicates whether an object supports transactions.

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

Version in a Microsoft Access workspace, returns the vesion of the Microsoft Jet or Microsoft Access database engine that created the database.

Containers - A Containers collection contains all of the Container objects that are defined in a database.

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.

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

QueryDefs - A QueryDefs collection contains all QueryDef objects of a Database object in a Microsoft Access database engine database.

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

Recordsets - A Recordsets collection contains all open Recordset objects in a Connection or Database object.

Relation - A Relation object represents a relationship between fields in tables or queries (Microsoft Access database engine databases only).

Relations - A Relations collection contains stored Relation objects of a Database object (Microsoft Access database engine databases only).

TableDef - A TableDef object represents the stored definition of a base table or a linked table (Microsoft Access workspaces only).

TableDefs - A TableDefs collection contains all stored TableDef objects in a database (Microsoft Access workspaces only).