Microsoft Access Automation Error

Active7 months ago

This is more an observation than a real question: MS-Access (and VBA in general) is desperately missing a tool where error handling code can be generated automatically, and where the line number can be displayed when an error occurs. Did you find a solution? What is it? I just realized how many hundreds of hours I spared since I found the right answer to this basic problem a few years ago, and I'd like to see what are your ideas and solutions on this very important issue.

We ran into the same problem, but with a twist - we have several people all using the same macros successfully, but one is having the 'Automation Error' 'Unspecified Error' problem. Your answer helped me identify that the problem might be due to the 'Microsoft ProgressBar Control'. (Thank you very much).

shruti1810
2,9541 gold badge12 silver badges27 bronze badges
Philippe GrondierPhilippe Grondier
9,2922 gold badges23 silver badges62 bronze badges

5 Answers

What about using 'Erl', it will display the last label before the error (e.g., 10, 20, or 30)?

BIBDBIBD
10.8k22 gold badges71 silver badges118 bronze badges

My solution is the following:

  1. install MZ-Tools, a very interesting add-on for VBA. No they did not pay me to write this. Version 3 was free, but since version 8.0, the add-in is commercially sold.
  2. program a standard error handler code such as this one (see MZ-Tools menu/Options/Error handler):

This standard error code can be then automatically added to all of your procs and function by clicking on the corresponding button in the MZ-Tools menu. You'll notice that we refer here to a hidden and undocumented function in the VBA standard library, 'Erl', which stands for 'error line'. You got it! If you ask MZ-Tools to automatically number your lines of code, 'Erl' will then give you the number of the line where the error occured. You will have a complete description of the error in your immediate window, such as:

Of course, once you realize the interest of the system, you can think of a more sophisticated error handler, that will not only display the data in the debug window but will also:

  1. display it as a message on the screen
  2. Automatically insert a line in an error log file with the description of the error or
  3. if you are working with Access or if you are connected to a database, automatically add a record to a Tbl_Error table!

meaning that each error generated at the user level can be stored either in a file or a table, somewhere on the machine or the network. Are we talking about building an automated error reporting system working with VBA?

AccessMathieu Guindon
52.7k8 gold badges76 silver badges172 bronze badges
Philippe GrondierPhilippe Grondier
9,2922 gold badges23 silver badges62 bronze badges

Microsoft Access Automation Error

Well there are a couple of tools that will do what you ask MZ Tools and FMS Inc come to mind.

Basically they involve adding an:

to the top of each procand at the end they put an:

label with usually a call to a global error handler where you can display and log custom error messages

DJ.DJ.
15k3 gold badges36 silver badges44 bronze badges

You can always roll your own tool like Chip Pearson did. VBA can actually access it's own IDE via the Microsoft Visual Basic for Applications Extensibility 5.3 Library. I've written a few class modules that make it easier to work with myself. They can be found on Code Review SE.

I use it to insert On Error GoTo ErrHandler statements and the appropriate labels and constants related to my error handling schema. I also use it to sync up the constants with the actual procedure names (if the function names should happen to change).

Community
RubberDuckRubberDuck
8,4973 gold badges33 silver badges81 bronze badges

There is no need to buy tools DJ mentioned. Here is my code for free:

Put it in a module and call it from Immediate Window every time you add new function or sub to a form or module like this (Form1 is name of your form):

Errors

It will alter your ode in Form1 from this:

to this:

Create now in a module a Sub which will display the error dialog and where you can add inserting the error to a text file or database:

This code does not enter error handling if there is already 'On Error' statement in a proc.

VladoVlado

Not the answer you're looking for? Browse other questions tagged vbams-accesserror-handlingaccess-vba or ask your own question.

Error Number: Error 2766
Error Name:The object doesn't contain the Automation object '|
Error Description: The object doesn't contain the Automation object '|.'@You tried to run a Visual Basic procedure to set a property or method for an object. However, the component doesn't make the property or method available for Automation operations.@Check the component'
Developer:Microsoft Corporation
Software:Microsoft Access
Applies to:Windows XP, Vista, 7, 8

Compatible with Windows 10, 8, 7, Vista, XP and 2000

Optional Offer for WinThruster by Solvusoft | EULA | Privacy Policy | Terms | Uninstall

Symptoms of Error 2766

  • 'Error 2766' appears and crashes the active program window.
  • Your PC frequently crashes with Error 2766 when running the same program.
  • “The object doesn't contain the Automation object '|” is displayed.
  • Windows runs sluggishly and responds slowly to mouse or keyboard input.
  • Your computer periodically “freezes” for a few seconds at a time.

These 2766 error messages can appear during program installation, while a Microsoft Corporation-related software program (eg. Microsoft Access) is running, during Windows startup or shutdown, or even during the installation of the Windows operating system. Keeping track of when and where your 2766 error occurs is a critical piece of information in troubleshooting the problem.

Causes of Error 2766

  • Corrupt download or incomplete installation of Microsoft Access software.
  • Corruption in Windows registry from a recent Microsoft Access-related software change (install or uninstall).
  • Virus or malware infection that has corrupted Windows system files or Microsoft Access-related program files.
  • Another program maliciously or mistakenly deleted Microsoft Access-related files.

Runtime Errors such as “Error 2766” can be caused by a variety of factors, so it is important that you troubleshoot each of the possible causes to prevent it from recurring.



Runtime Errors Knowledgebase

Article ID:

130576

Article Author:

Last Updated:

Popularity:

star rating here


Optional Offer for WinThruster by Solvusoft
EULA | Privacy Policy | Terms | Uninstall



Recommendation:Scan your PC for computer errors.

Optional Offer for WinThruster by Solvusoft | EULA | Privacy Policy | Terms | Uninstall

Below is a list of troubleshooting steps to resolve your Error 2766 problems. These troubleshooting steps get progressively more difficult and time consuming, so we strongly recommend attempting them in ascending order to avoid unnecessary time and effort.


Please Note: Click the [ ] image to expand the troubleshooting instructions for each step below. You can also click the [ ] image to hide the instructions as you proceed through each step.

Step 1: Repair Registry Entries Associated with Error 2766


Manually editing the Windows registry to remove invalid Error 2766 keys is not recommended unless you are PC service professional. Incorrectly editing your registry can stop your PC from functioning and create irreversible damage to your operating system. In fact, one misplaced comma can prevent your PC from booting entirely!

Because of this risk, we highly recommend using a trusted registry cleaner such as WinThruster [download] (Developed by Microsoft Gold Certified Partner) to scan and repair any Error 2766-related registry problems. Using a registry cleaner [download] automates the process of finding invalid registry entries, missing file references (like the one causing your 2766 error), and broken links within the registry. A backup is automatically created before each scan, with the ability to undo any changes in a single click, protecting you against the possibility of PC damage. The best part is that repairing registry errors [download] can also dramatically improve system speed and performance.


Caution: Unless you an advanced PC user, we DO NOT recommend editing the Windows registry manually. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall Windows. We do not guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

To manually repair your Windows registry, first you need to create a backup by exporting a portion of the registry related to Error 2766 (eg. Microsoft Access):

  1. Click the Start button.
  2. Type 'command' in the search box... DO NOT hit ENTER yet!
  3. While holding CTRL-Shift on your keyboard, hit ENTER.
  4. You will be prompted with a permission dialog box.
  5. Click Yes.
  6. A black box will open with a blinking cursor.
  7. Type 'regedit' and hit ENTER.
  8. In the Registry Editor, select the Error 2766-related key (eg. Microsoft Access) you want to back up.
  9. From the File menu, choose Export.
  10. In the Save In list, select the folder where you want to save the Microsoft Access backup key.
  11. In the File Name box, type a name for your backup file, such as 'Microsoft Access Backup'.
  12. In the Export Range box, be sure that 'Selected branch' is selected.
  13. Click Save.
  14. The file is then saved with a .reg file extension.
  15. You now have a backup of your Microsoft Access-related registry entry.

The next steps in manually editing your registry will not be discussed in this article due to the high risk of damaging your system. If you would like to learn more about manual registry editing, please see the links below.


We do not claim any responsibility for the results of the actions taken from the content linked below - complete these tasks at your own risk.

Windows XP
http://www.theeldergeek.com/windows_xp_registry.htm

Windows 7
http://www.theeldergeek.com/windows_7/registry_edits_for_win7.htm

Windows Vista
http://support.microsoft.com/kb/2688326 - LetMeFixItMyselfAlways


Step 2: Conduct a Full Malware Scan of Your PC


There is a chance that your 2766 error could be related to a malware infection on your PC. These malicious intruders can damage, corrupt, or even delete Runtime Errors-related files. Furthermore, there's a possibility that the 2766 error you are experiencing is related to a component of the malicious program itself.


Tip: If you do not already have a malware protection program installed, we highly recommend using Emsisoft Anti-Malware (download here). They offer a malware removal guarantee that is not offered by other security software.


Step 3: Clean Out Your System Junk (Temporary Files and Folders) With Disk Cleanup (cleanmgr)


Over time, your computer accumulates junk files from normal web surfing and computer use. If this junk isn't occasionally cleaned out, it can cause Microsoft Access to respond slowly or provides an 2766 error, possibly due to file conflicts or an overloaded hard drive. Cleaning up these temporary files with Disk Cleanup might not only solve your 2766 error, but can also dramatically speed up the performance of your PC.


Tip: Although Disk Cleanup is a wonderful built-in tool, it will not completely clean up all of the temporary files on your computer. Other programs that you frequently use such Microsoft Office, Firefox, Chrome, Live Messenger, and hundreds of other programs are not cleaned up with Disk Cleanup (including some Microsoft Corporation programs).


Because of the shortcomings of the Windows Disk Cleanup (cleanmgr) tool, we highly recommend using a specialized hard drive cleanup / privacy protection software such as WinSweeper [download] (Developed by Microsoft Gold Partner) to clean up your entire computer. Running WinSweeper [download] once per day (using automatic scanning) will ensure that your computer is always clean, running fast, and free of 2766 errors related to temporary files.

How to run Disk Cleanup (cleanmgr) (Windows XP, Vista, 7, 8, and 10):

  1. Click the Start button.
  2. Type 'command' in the search box... DO NOT hit ENTER yet!
  3. While holding CTRL-Shift on your keyboard, hit ENTER.
  4. You will be prompted with a permission dialog box.
  5. Click Yes.
  6. A black box will open with a blinking cursor.
  7. Type 'cleanmgr' and hit ENTER.
  8. Disk Cleanup will begin calculating how much occupied disk space you can reclaim.
  9. The Disk Cleanup dialog box will appear with series of checkboxes you can select. In most cases, the 'Temporary Files' category will occupy the most disk space.
  10. Check the boxes of the categories you want to clean and click OK.

Step 4: Update Your PC Device Drivers


2766 errors can be related to corrupt or outdated device drivers. Drivers can work one day, and suddenly stop working the next day, for a variety of reasons. The good news is that you can often update the device driver to fix the Error 2766 problem.

Finding the exact driver for your Error 2766-related hardware device can be extremely difficult, even directly on the Microsoft Corporation or related manufacturer's website. Even if you are experienced at finding, downloading, and manually updating drivers, the process can still be very time consuming and extremely irritating. Installing the wrong driver, or simply an incompatible version of the right driver, can make your problems even worse.

Because of the time and complexity involved in updating drivers, we highly recommend using a driver update tool such as DriverDoc (Developed by Microsoft Gold Partner) to automate the process.

DriverDoc updates all of your PC device drivers, not just those associated with your 2766 error. DriverDoc's proprietary One-Click Update™ technology not only ensures that you have correct driver versions for your hardware, but it also creates a backup of your current drivers before making any changes. Maintaining a driver backup provides you with the security of knowing that you can rollback any driver to a previous version if necessary. With updated device drivers, you can finally unlock new hardware features and improve the speed and performance of your PC.


Please Note: Your Error 2766 may not be related to hardware driver problems, but it's always a good idea to ensure all of your PC device drivers are up-to-date to maximize PC performance.


Step 5: Utilize Windows System Restore to 'Undo' Recent System Changes


Windows System Restore allows you to 'go back in time' with your PC to help fix your Error 2766 problems. System Restore can return your PC's system files and programs back to a time when everything was working fine. This can potentially help you avoid hours of troubleshooting headaches associated with 2766 errors.


Please Note: Using System Restore will not affect your documents, pictures, or other data.

To use System Restore (Windows XP, Vista, 7, 8, and 10):

  1. Click the Start button.
  2. In the search box, type 'System Restore' and hit ENTER.
  3. In the results, click System Restore.
  4. Enter any administrator passwords (if prompted).
  5. Follow the steps in the Wizard to choose a restore point.
  6. Restore your computer.

Step 6: Uninstall and Reinstall the Microsoft Access Program Associated with Error 2766


If your 2766 error is related to a specific program, reinstalling Microsoft Access-related software could be the answer.

Instructions for Windows 7 and Windows Vista:

  1. Open Programs and Features by clicking the Start button.
  2. Click Control Panel on the right side menu.
  3. Click Programs.
  4. Click Programs and Features.
  5. Locate The object doesn't contain the Automation object '|-associated program (eg. Microsoft Access) under the Name column.
  6. Click on the Microsoft Access-associated entry.
  7. Click the Uninstall button on the top menu ribbon.
  8. Follow the on-screen directions to complete the uninstallation of your Error 2766-associated program.

Instructions for Windows XP:

  1. Open Programs and Features by clicking the Start button.
  2. Click Control Panel.
  3. Click Add or Remove Programs.
  4. Locate The object doesn't contain the Automation object '|-associated program (eg. Microsoft Access) under the list of Currently Installed Programs.
  5. Click on the Microsoft Access-associated entry.
  6. Click the Remove button on the right side.
  7. Follow the on-screen directions to complete the uninstallation of your Error 2766-associated program.

Instructions for Windows 8:

  1. Hover the cursor in the bottom left of the screen to produce the Start Menu image.
  2. Right-Click to bring up the Start Context Menu.
  3. Click Programs and Features.
  4. Locate The object doesn't contain the Automation object '|-associated program (eg. Microsoft Access) under the Name column.
  5. Click on the Microsoft Access-associated entry.
  6. Click the Uninstall/Change on the top menu ribbon.
  7. Follow the on-screen directions to complete the uninstallation of your Error 2766-associated program.

After you have successfully uninstalled your Error 2766-associated program (eg. Microsoft Access), reinstall the program according to the Microsoft Corporation instructions.


Tip: If you are positive that your 2766 error is related to a specific Microsoft Corporation program, uninstalling and reinstalling your Error 2766-related program will likely be the solution to your problem.


Step 7: Run Windows System File Checker ('sfc /scannow')


System File Checker is a handy tool included with Windows that allows you scan for and restore corruptions in Windows system files (including those related to Error 2766).

To run System File Checker (Windows XP, Vista, 7, 8, and 10):

  1. Click the Start button.
  2. Type 'command' in the search box... DO NOT hit ENTER yet!
  3. While holding CTRL-Shift on your keyboard, hit ENTER.
  4. You will be prompted with a permission dialog box.
  5. Click Yes.
  6. A black box will open with a blinking cursor.
  7. Type 'sfc /scannow' and hit ENTER.
  8. System File Checker will begin scanning for Error 2766 and other system file problems (be patient - the system scan may take a while).
  9. Follow the on-screen commands.

Step 8: Install All Available Windows Updates


Microsoft is constantly updating and improving Windows system files that could be associated with Error 2766. Sometimes resolving your Runtime Errors problems may be as simple as updating Windows with the latest Service Pack or other patch that Microsoft releases on an ongoing basis.

To check for Windows Updates (Windows XP, Vista, 7, 8, and 10):

  1. Click the Start button.
  2. Type 'update' into the search box and hit ENTER.
  3. The Windows Update dialog box will appear.
  4. If updates are available, click the Install Updates button.

Step 9: Perform a Clean Installation of Windows


Caution: We must emphasize that reinstalling Windows will be a very time-consuming and advanced task to resolve Error 2766 problems. To avoid data loss, you must be sure that you have backed-up all of your important documents, pictures, software installers, and other personal data before beginning the process. If you are not currently backing up your data, you need to do so immediately (download a highly-recommended backup solution) to protect yourself from permanent data loss.

This step is your final option in trying to resolve your Error 2766 issue. Reinstalling Windows will erase everything from your hard drive, allowing you to start again with a fresh system. Furthermore, a clean install of Windows will also quickly clean out any and all 'junk' that has accumulated over the normal usage of your computer.


Please Note: If 2766 errors still persist after a clean install of Windows, your Runtime Errors problem MUST be hardware related. If that is the case, then it is likely you will need to replace the associated hardware causing the 2766 error.


Recommendation:Scan your PC for computer errors.

Optional Offer for WinThruster by Solvusoft | EULA | Privacy Policy | Terms | Uninstall


Operating System Information

2766 error messages can occur in any of the following Microsoft Windows operating systems:

  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Vista
  • Windows XP
  • Windows ME
  • Windows 2000

Are You Still Experiencing Error 2766 Issues?

Please reach out to us anytime on social media for more help:


Optional Offer for WinThruster by Solvusoft | EULA | Privacy Policy | Terms | Uninstall


Recommendation:Scan your PC for computer errors.

Optional Offer for WinThruster by Solvusoft | EULA | Privacy Policy | Terms | Uninstall

About The Author:Jay Geater is the President and CEO of Solvusoft Corporation, a global software company focused on providing innovative utility software. He is a lifelong computer geek and loves everything related to computers, software, and new technology.

Common Microsoft Access Errors


Odbc Microsoft Access Driver Internal Ole Automation Error

Browse Errors in Alphabetical Order: