Share via


CurrentData Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Application
Aa199164.parchild(en-us,office.10).gifCurrentData
Aa199164.space(en-us,office.10).gifAa199164.parchild(en-us,office.10).gif

The CurrentData object refers to the objects stored in the current database by the source (server) application (Jet or SQL).

Using the CurrentData Object

The CurrentData object has several collections that contain specific AccessObject objects within the current database. The following table lists the name of each collection defined by the database and the types of objects it contains.

Collections Object type
AllTables All tables
AllFunctions All functions
AllQueries All queries (the count of queries in a Microsoft Access project (.adp) will be zero).
AllViews All views (the count of views in an Access database (.mdb) database will be zero).
AllStoredProcedures All stored procedures (the count of stored procedures in a .mdb database will be zero).
AllDatabaseDiagrams All database diagrams (the count of database diagrams in a .mdb database will be zero).

Note The collections in the preceding table contain all of the respective objects in the database regardless if they are opened or closed.

For example, an AccessObject representing a table is a member of the AllTables collection, which is a collection of AccessObject objects within the current database. Within the AllTables collection, individual tables are indexed beginning with zero. You can refer to an individual AccessObject object in the AllTables collection either by referring to the table by name, or by referring to its index within the collection. If you want to refer to a specific item in the AllTables collection, it's better to refer to it by name because the item's index may change. If the object name includes a space, the name must be surrounded by brackets ([ ]).

Syntax Example
AllTables!tablename AllTables!OrderTable
AllTables![table name] AllTables![Order Table]
AllTables("tablename") AllTables("OrderTable")
AllTables(index) AllTables(5)