Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Programmatically Create a New Data Access Page


View products that this article applies to.

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 (http://support.microsoft.com/kb/299018/EN-US/ ) .

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: KB200216, kbhowto, kbdapscript, kbdap

↑ Back to the top

Article Info
Article ID : 200216
Revision : 4
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 370