Access can not Find Project Or Library Error

Scenario:

Recently I installed MS Office 2010 Pro trial version and receive the following Macro error in Access: compile error “Can’t find project or library”.  I tried setting the macro security level to low in 2010; however, the macro still will not run.   I don’t know how do I fix this error.

source: https://social.technet.microsoft.com/Forums/office/en-US/09288f15-72a0-4410-84be-cfb5e87908b6/excel-2010-macro-compile-error-cant-find-project-or-library?forum=officesetupdeployprevious

If you too getting the same error in your Access Database, then try the mentioned solutions given in this post. following these procedures  will surely help you in resolving this error on your own. 

Libraries are the component that provides functionality. Access and its programming language (VBA) are two essential libraries in every project. If access don’t provide something for which you are looking for then you can find a library and add it. But sometime adding extra libraries raises the numerous issues.

Problem:

When using the VBA code or macros in Access, the following errors is received “Compile Error: Can’t find project or library”. well this error is also commonly rendered in excel 2016 with the following error message : Can’t find project or library Excel 2016.

Reason Behind The Access Can’t Find Project Or Library Error

Access loads the relevant file (such as a type library, an object library, or a control library) for each reference, as per the information shown in the References box. If Access is unable to fetch this file, then it will perform the following procedures to search for the file.

  1. Access checks for the referenced file whether it is currently loaded in memory or not.
  2. If the file is not loaded there, then the Access tries to verify that RefLibPaths registry key exists there or not. If it is present there, Access checks for a named value which is having the same name as that of the reference. If it matches well, Access loads the reference from the path that the named value points to.
  3. After this the Access make searches for the referenced file in the following location and in this order:
    1. The Application folder (the location of the Msaccess.exe file).
    2. The current folder that you see if you click Open on the File
    3. The Windows or Winnt folder where the operating system files are running.
    4. The System folder under the Windows or Winnt folder.
    5. The folders in the PATH environment variable that is directly accessible by the operating system.
  4. If access won’t get such file then reference error occurs.

Also read: [Resolved] Microsoft Access Can’t Open The Form Or Report

Lists of Reference Error Messages

Following here is the list of some reference error message that Access users frequently encounters.

  • “Can’t find project or library”
  • “Method MethodName of Object ObjectName Failed”
  • “Function is not available in Usage expression”
  • “Variable not defined” or “User-defined type not defined”
  • “Invalid procedure call or argument,”
  • “ActiveX component can’t create object”

Solution To Fix  “Can’t find project or library” Error

Method 1: Adding Or Removing A Reference To A Library

Chances are that application has lost the reference to an object or type library resulting in above error when using macros and native VBA functions.

 To resolve this, try the following steps:

  1. Open your Access Database or application.
  2. Now open the module in design view or simply press ALT+F11 to switch to the Visual Basic Editor.
  3. Go to the Tools menu, click References.
  4. Uncheck the check box for the type library or object library marked as “Missing:”

 Alternatively, in order to remove the reference; restore the referenced file to the path specified in the reference dialog box. If the referenced file is somewhere else in the new location, clear the “Missing:” reference and generate new reference to the file in its new location.

Also read: How To Fix MS Access Reserved Error 7713, 7748, 7711 In Access 2016/ 2013/2010/2007

Method 2: Registering a Library File

Installation and un-installation of any software overwrite, remove or sometime de-register libraries. In that case simple functions like Date() or Trim() don’t work.

To see what libraries an Access Project is referenced, open any code window and choose the References option from the Tools menu.

It is possible for the file to be there in the reference list without being correctly registered in the registry. If you suspect such case, then follow these steps to register the file.

  1. Click Start, and then go to the Search option after then click For Files and Folders.
  2. In the Search for files and folders named box, type exe.
  3. In the Look inbox, tap the root of the hard disk.
  4. Select the check box Include Subfolders, if it is not selected and then click Find Now or Search Now.
  1. After getting the file, click Start<Run and after this delete anything which is in the Open
  2. Drag the exe file from the search panel to the Open box.
  3. Repeat from steps no. 2 to 6, but this time search for
    FileName.dll, where
    FileName is that file name that you want to register.
  4. When the FileName.dll file is in the Openbox with the Regsvr32.exe file, tap to the OK.
  5. In Access, check whether the problem is actually.

If you don’t get this Regsvr32.exe file on your system then, check other computers for the file, you can also obtain this file from Microsoft Web site. 

Method 3: Try Un-Register Or Re-Register The Library

If the library is marked missing, then click the Browse button and search for the file for the library.

If still the library is not shown, you may need to re-register it.  For this, just follow down this:

  • Tap to the windows start button and select the run option.
  • Now enter regsvr32followed with the full path of the library file.
  • If the file name contains the spaces then include quotes, like this:
    regsvr32 “c:\program files\common files\microsoft shared\dao\dao360.dll”

Sometimes, the problem is not get resolved until you re-register the library. So first of all unregister the library with this command and then follow the above one to re-register it again:

  • Uncheck the missing library in access.
  • Close access
  • Issue this command to unregister the library :

regsvr32 -u “c:\program files\common files\microsoft shared\dao\dao360.dll”

  • After this re-register it again with the above command and select the library reference again.

Conclusion:

Don’t forget to compile all modules after making adjustments in the references. To compile all the modules with the module still open, click to the Compile database on the Debug menu. If the modules don’t get complied, there may be additional unresolved references.

How To Fix Access “Can’t Find Project Or Library” Error