DataAccessPage Object [Access 2003 VBA Language Reference]

Multiple objects
DataAccessPage
WebOptions

A DataAccessPage object refers to a particular Microsoft Access data access page.

Using the DataAccessPage Object

A DataAccessPage object is a member of the DataAccessPages collection, which is a collection of all currently open data access pages. Within the DataAccessPages collection, individual data access pages are indexed beginning with zero. You can refer to an individual DataAccessPage object in the DataAccessPages collection either by referring to the data access page by name, or by referring to its index within the collection. If you want to refer to a specific data access page in the DataAccessPages collection, it's better to refer to the data access page by name because a data access page's collection index may change. If the data access name includes a space, the name must be surrounded by brackets ([ ]).

Syntax Example
DataAccessPages!pagename DataAccessPages!SalePage
DataAccessPages![page name] DataAccessPages![Sale Page]
DataAccessPages("pagename") DataAccessPages("Sale Page")
DataAccessPages(index) DataAccessPages(0)

The following example creates a new data access page and sets certain properties:

Sub NewDataAccessPage()
    Dim dap As AccessObject
    ' Create new data access page.
    Set dap = CreateDataAccessPage("c:\My Documents\Sales Entry", _
            True)
    ' Set data access page Tag property.
    dap.Tag = "Sales Entry Data Access Page"
    ' Restore data access page.
    DoCmd.Restore
End Sub

The next example enumerates the DataAccessPages collection and prints the name of each data access page in the DataAccessPages collection.

Sub AllOpenDataAccessPages()
    Dim dap As AccessObject

    Set dbs = Application.CurrentProject
    ' Search for open objects in DataAccessPages collection.
    For Each dap In dbs.AllDataAccessPages
        If dap.IsLoaded = TRUE then
            ' Print name of form.
            Debug.Print dap.Name
        End If
    Next dap
End Sub

Properties | ConnectionString Property | CurrentView Property | Document Property | MailEnvelope Property | MSODSC Property | Name Property | RemovePersonalInformation Property | Visible Property | WebOptions Property | WindowHeight Property | WindowWidth Property

Methods | ApplyTheme Method

Parent Objects | DataAccessPages Collection | Screen Object

Child Objects | WebOptions Object

See Also | Application Object | DataAccessPages Collection