XL: Run-time Error '424': Object Required Using DAO

ID: Q163475


The information in this article applies to:
  • Microsoft Excel 97 for Windows
  • Microsoft Excel for Windows 95, version 7.0

IMPORTANT: This article contains information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information about how to do this, view the "Restoring the Registry" Help topic in Regedit.exe or the "Restoring a Registry Key" Help topic in Regedt32.exe.

SYMPTOMS

When you run a Visual Basic for Applications macro that uses Data Access Object, you may receive the following error message:

Run-time Error '424':
Object Required


CAUSE

This problem may occur when either of the following is true:

  • The Data Access Object library is not properly referenced.


  • -or-

  • The Data Access Object files are missing, damaged, or improperly registered.


NOTE: This problem may also occur if, when you use Microsoft Excel under Windows NT 4.0, the Microsoft Access Object Library is not referenced.


RESOLUTION

To resolve this problem, use the following appropriate method.

Method 1: Data Access Object Library Is Not Registered

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it. If you are running Windows NT, you should also update your Emergency Repair Disk (ERD).

If the Data Access Object library is not properly referenced, follow these steps to create a reference to the library:

Microsoft Excel 97:

  1. Open the file and press ALT+F11 to open the Visual Basic Editor.


  2. In the Visual Basic Editor, click References on the Tools menu.


  3. In the References dialog box, under Available References, click "Microsoft DAO 3.5 Object Library," and then click OK.

    If "Microsoft DAO 3.5 Object Library" is not listed in the box under Available References, click Browse and find the Dao350.dll file.

    This file is located in the following folder:
    
          Program Files\Common Files\Microsoft Shared\Dao 


  4. Click the file and click OK.


Microsoft Excel 7.0:

  1. Click a Module Sheet.


  2. On the Tools menu, click References.

    NOTE: It is necessary click a Module Sheet. References is not available on the Tools menu on a worksheet, dialog sheet, or chart sheet.


  3. In the References dialog box, under Available References, click "Microsoft DAO 3.0 Object Library," and then click OK.

    If "Microsoft DAO 3.0 Object Library" is not listed in the box under Available References, click Browse and find the Dao3032.dll file.

    This file is located in the following folder:
    
          Program Files\Common Files\Microsoft Shared\Dao 
    Click the file and click OK.


  4. In the References dialog box, click OK.


NOTE: If you are using Windows NT 4.0, you may also need to create a reference to the Microsoft Access Object Library. To do this, use the steps shown above for your version of Microsoft Excel.

Also, if you reference the Microsoft Access Object Library, it must be referenced BEFORE the Microsoft Data Access Object Library. To change the order in which libraries are referenced in Microsoft Excel 97, select the appropriate library in the References dialog box. Then, use the Priority buttons to move the references up and down in the list as required. When you are done, click OK.

In Microsoft Excel 7.0, if the Microsoft Data Access Object Library is referenced BEFORE the Microsoft Access Object Library, click the Microsoft Data Access Object Library to remove the check mark from the check box and Click OK. From the Tools menu, click Reference and select the Microsoft Data Access Object Library check box to reselect this option. Click OK. This places the Microsoft Data Access Object Library reference after the Microsoft Access Object Library in the reference list.

Method 2: Data Access Object Files are Missing, Damaged, or Unregistered

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
Testing the Data Access Object Engine:

Before you proceed with the steps to replace the Data Access Object files, test the Data Access Object engine with a macro to ensure that it is working. To do this, type the following macro in a new module, and then run the macro:

   Sub DAO_Test()
       MsgBox DBEngine.Version
   End Sub 
If the macro returns an error message, and you already referenced the Data Access Object library, you must reinstall the Data Access Object engine by removing and then reinstalling it. If you installed Data Access Object multiple times, (this can occur when you install multiple programs), you must edit the registry so that the Data Access Object components are removed when you remove Microsoft Office. To edit the registry, use the following steps:

  1. On the Start menu, click Run. In the Open box, type regedit, and then click OK.


  2. Open the following registry key:
    
          HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/Current
          Version/SharedDLLs 


  3. Click the following value in the SharedDLLs folder:
    
          C:\Program Files\Common Files\Microsoft Shared\DAO\dao3032.dll 
    If you are using Microsoft Excel 97, click the following value in the SharedDLLs folder:
    
          C:\Program Files\Common Files\Microsoft Shared\DAO\DAO350.DLL 


  4. On the Edit menu, click Modify. The edit DWORD value dialog box appears. If the value data box value is greater than 1, change it to 1, and then click OK.


  5. On the Registry menu, click Exit.


  6. Run the Microsoft Office Setup program in maintenance mode. When you are prompted, click Remove All.


  7. When you are prompted to remove shared components, click Remove All.

    If you are prompted to restart the computer after Setup is completed, do so.


  8. Install Microsoft Office.


If you continue to receive the error message in this article, continue troubleshooting by using the following steps:

  1. Open the file in Microsoft Excel.


  2. Click the module sheet to switch to it. If you are using Microsoft Excel 97, press ALT+F11 to start Visual Basic for Applications, and then click the module sheet that contains the Data Access Object macro code.


  3. On the Tools menu, click References. Clear any references to the Data Access Object libraries. Click OK.


  4. On the Tools menu, click Add-Ins. If you are using Microsoft Excel 97, you can find the Add-Ins command only on a worksheet. Clear all the add-in check boxes and click OK.


  5. On the File menu, click Save. Then, click Exit on the File menu.


  6. Restart Microsoft Excel and open the file. Reference the Data Access Object library you want to use.


If the problem continues to occur after you follow these steps, you may need to reinstall Microsoft Windows 95.

For additional information, please see the following article in the Microsoft Knowledge Base:
Q178400 OFF97: Installing Win 95 to New Folder to Tshoot Office Problems

Additional query words: 97 opendatabase XL7 XL97

Keywords : kberrmsg kbprg kbdta KbVBA
Version : WINDOWS:7.0
Platform : WINDOWS
Issue type :


Last Reviewed: November 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.