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.
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 doesn’t provide something for which you are looking for then you can find a library and add it. But sometimes adding extra libraries raises numerous issues.
When using the VBA code or macros in Access, the following errors are 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.
- Access checks for the referenced file whether it is currently loaded in memory or not.
- If the file is not loaded there, then the Access tries to verify that RefLibPaths registry key exists there or not. But, if it is present there then 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.
- After this the Access make searches for the referenced file in the following location and in this order:
- The Application folder (the location of the Msaccess.exe file).
- The current folder that you see if you click Open on the File
- The Windows or Winnt folder where the operating system files are running.
- The System folder under the Windows or Winnt folder.
- The folders in the PATH environment variable that is directly accessible by the operating system.
- If access won’t get such a file then reference error occurs.
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
Below here is the following manual method to resolve VBA can’t find project or library error.
Method 1: Adding Or Removing A Reference To A Library
Chances are that the application has lost the reference to an object or type library resulting in the above error when using macros and native VBA functions.
To resolve this, try the following steps:
- Open your Access Database or application.
- Now open the module in design view or simply press ALT+F11 to switch to the Visual Basic Editor.
- Go to the Tools menu, click References.
- Un-check the checkbox 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.
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 a case, then follow these steps to register the file.
- Click Start, and then go to the Search option after then click For Files and Folders.
- In the Search for files and folders named box, type exe.
- In the Look in box, tap the root of the hard disk.
- Select the checkbox Include Subfolders, if it is not selected and then click Find Now or Search Now.
- After getting the file, click Start<Run and after this delete anything which is in the Open
- Drag the exe file from the search panel to the Open box.
- Repeat from steps no. 2 to 6, but this time search for
FileName is the file name that you want to register.
- When the FileName.dll file is in the Open box with the Regsvr32.exe file, tap to the OK.
- 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.
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 compiled, there may be additional unresolved references.