ACC2000: Properties of the DataAccessPages Object May Return Error Message

ID: Q223205


The information in this article applies to:

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

This article applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp).


SYMPTOMS

When you use a property of the DataAccessPages object, you may get one of the following error messages:

Run-time error '2018':

The data access page name 'page name' you entered is misspelled or refers to a data access page that isn't open or doesn't exist.
-or-
Run-time error '2019':

The number you used to refer to the data access page is invalid.


CAUSE

You get one of these error messages when you try to use a property of the DataAccessPages object and the data access page is open in Microsoft Internet Explorer. The DataAccessPages object is looking for pages that are open in Microsoft Access. Because the page is open in Internet Explorer, and not in Access, the DataAccessPages object does not recognize it as being open.

NOTE: When you click the Web Page Preview command on the File menu, the page does not open in Access. It opens in Internet Explorer.


RESOLUTION

To use one of these properties, you must have the page open in Design view or Page view in Access.


MORE INFORMATION

The properties of the DataAccessPages object with which you could see these errors are as follows:

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb.


  2. In the Database window, click Pages under Objects, and then click New.


  3. Click Page Wizard and click OK.


  4. In the Tables/Queries list, click Table: Categories. Move CategoryID from the Available Fields list to the Selected Fields list, and then click Finish.


  5. Press CTRL+G to open the Immediate window. Type the following line, and then press ENTER:
    
    ?Application.DataAccessPages(0).ConnectionString 
    Note that this returns the connection string.


  6. Press ALT+F11 to switch back to Access.


  7. On the File menu, click Save.


  8. In the Save As Data Access Page dialog box, note the name of the page, and then click Save.


  9. On the File Menu, click Close.


  10. Right-click the page that you saved in step 8. On the shortcut menu, click Web Page Preview.


  11. Switch back to Access.


  12. Press CTRL+G to open the Immediate window. Type the following line, and then press ENTER:
    
    ?Application.DataAccessPages(0).ConnectionString 
    Note that this returns the second error listed in the "Symptoms" section.


Additional query words: DAP prb


Keywords          : kberrmsg kbdta AccDAP DAPProb 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: August 5, 1999