Microsoft KB Archive/299018

= ACC2002: How to Programmatically Create a New Data Access Page =

Article ID: 299018

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q299018



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 2000 version of this article, see 200216.



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:  Open the sample database Northwind.mdb, and then create a new module.  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   Run this new procedure by typing the following code into the Immediate window, and then pressing ENTER: MyNewPage(&quot;MyTestPage&quot;)  In the Database window, click Pages under Objects, and note that a new page named MyTestPage was created.

