ACC2000: How to Programmatically Create a New Data Access Page (200216)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q200216
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

Moderate: Requires basic macro, coding, and interoperability skills.

For a Microsoft Access 2002 version of this article, see 299018.

SUMMARY

This article shows you how to use the CreateDataAccessPage method to programmatically create data access pages. This method allows you to specify the name and path of a new data access page, as well as allowing you the flexibility of linking to existing pages.

MORE INFORMATION

To create a new data access page programmatically, follow these steps:
  1. Open the sample database Northwind.mdb, and then create a new module.
  2. Type the following procedure into the new module:
    Sub MyNewPage(MyPageName as String)
        Dim dapNewPage As DataAccessPage
        Set dapNewPage = Application.CreateDataAccessPage(MyPageName,True)
        DoCmd.Close acDataAccessPage, dapNewPage.Name, acSaveYes
    End Sub
    					
  3. Run this new procedure by typing the following code into the Immediate window, and then pressing ENTER:
    MyNewPage("MyTestPage")
    					
  4. In the Database window, click Pages under Objects, and note that a new page named MyTestPage was created.

REFERENCES

For more information about creating data access pages programmatically, click Microsoft Visual Basic Help on the Help menu, type createdataaccesspage in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbDAP kbDAPScript kbhowto KB200216