BUG: You receive an "Bad File Name or Number" error message when you upsize databases with Data Access Pages stored on server

Article translations Article translations
Article ID: 282380 - View products that this article applies to.
This article was previously published under Q282380
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access database (.mdb).

Expand all | Collapse all

On This Page

SYMPTOMS

When you use the Upsizing Wizard to convert a Microsoft Access database that contains data access pages to an Access project, you may receive the following error message:
UT_HandleADPDataPages Bad file name or number 52

CAUSE

This behavior can occur because the data access pages are linked by using a Web server path such as http://, ftp://, or https://. The Upsizing Wizard does not properly handle these paths when it creates the new project.

RESOLUTION

To work around this issue, use one of the following methods.

Method 1: Re-create Links

Re-create the links to the existing data access pages after the new Access project has been created.

Method 2: Use VBA Code

Use Microsoft Visual Basic for Applications (VBA) code to re-create pages whose links are not copied correctly by the Upsizing Wizard.

NOTE: This code will modify existing data access pages. It is recommended that you create backups of your pages before running this code.

To relink the pages using VBA code, follow these steps:

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
  1. Click the Modules object in the newly created Access project, and then click New.
  2. Type or paste the following code in the Visual Basic Editor:
    Sub RelinkDataPages(strPathToMDBFile As String)
    
        ' Automates Access to create a new data access page in the
        ' project file (.adp) from the links in the database (.mdb) file
        Dim ao As AccessObject
        Dim dp As DataAccessPage
        
        Dim objAccApp As Access.Application
        Set objAccApp = New Access.Application
        
        With objAccApp
            ' open the original MDB file
            .OpenCurrentDatabase strPathToMDBFile
            For Each ao In .CurrentProject.AllDataAccessPages
                
                ' Create the new path with the link from the existing page
                Set dp = Application.CreateDataAccessPage(ao.FullName, False)
                
                ' Modify the connection of the page to match the ADP's connection info.
                ' Using the .Connection or .AccessConnection property includes the
                ' Microsoft.Access.OLEDB.10.0 provider and will not work in the connection
                ' string of a data access page.  As a result, use the .BaseConnectionString
                ' property instead to get the basic information.
    
                ' If you are using SQL Server security, you will need to
                ' to concatenate the user name and password information
                ' for the page.
                dp.MSODSC.ConnectionString = CurrentProject.BaseConnectionString
                
                ' save the new page
                DoCmd.Save acDataAccessPage, dp.Name
                
                ' close the page
                DoCmd.Close acDataAccessPage, dp.Name
                
            Next
        End With
        
        ' cleanup
        Set ao = Nothing
        objAccApp.Quit
        Set objAccApp = Nothing
        
        MsgBox "Pages have been relinked"
    End Sub
    					
  3. Save the module as FixLinks.
  4. Type the following line in the Immediate window and press ENTER
    RelinkDataPages "<FullPathToDatabase>"
    					
    where <FullPathToDatabase> is the path to the database that you just upsized.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

When you use the Upsizing Wizard to convert an Access database to an Access project, objects in the database are copied to the corresponding objects in the new project. Page objects are actually links or shortcuts to Web pages stored outside of the database file. The pages may be stored locally, on a shared network resource and accessed through the file system, or on a Web server and accessed through an Internet protocol such as HTTP, HTTPS, or FTP.

When page objects are copied, the Upsizing Wizard is able to copy the links only when both of the following conditions are true:
  • The pages are accessed through the file system either locally or over a network.

    In other words, they are not accessed through an Internet protocol.

    - and -
  • The page links are valid; that is, the pages have not been moved, deleted, or renamed.
For page links saved to an Internet protocol, you receive the error message described in the "Symptoms" section of this article when you upsize the database. You receive no error message for invalid links that point to a file system. In this case, you may find it useful to verify the links before you upsize the database.

Steps to Reproduce the Problem

  1. Start Access and create a new blank database.
  2. Import the Employees table from the sample database Northwind.mdb.
  3. Create a new page based on the Employees table and save it to an Internet directory on which you have permissions.
  4. On the Tools menu, point to Database Utilities, and then click Upsizing Wizard.
  5. Accept the defaults in the Upsizing Wizard, and then select a Microsoft SQL Server computer on which you have "create database" permissions.

    Notice that when the Upsizing Wizard begins to copy pages, it pauses at the existing Web page and displays the error message described in the "Symptoms" section of this article.
  6. Click OK in the error message (or messages) and close the Upsizing Wizard report.
  7. Click the Pages object in the Database window, and then notice that the data access page link was not copied to the Access project as expected.

Properties

Article ID: 282380 - Last Review: October 11, 2006 - Revision: 4.3
APPLIES TO
  • Microsoft Access 2002 Standard Edition
Keywords: 
kbwizard kbdap kbtshoot kbbug kberrmsg kbnofix KB282380

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com