How to repair a missing library reference

One of the most common questions I receive concerns an unexpected error. Everything's working fine and suddenly, the user gets a vague error message that says they're trying to use an undefined function or that the function isn't available in query expressions. It's frustrating because neither message is a bit helpful, and you can't continue working. It'll drive you to distraction if you don't know how to resolve it.

This error occurs when a reference to a library goes missing -- literally. Fortunately, fixing it is easy. If you receive either of the above errors, do the following:

  1. Launch the Visual Basic Editor (VBE), if necessary.
  2. From the Tools menu, choose References.
  3. Check the list in the Available References control for a library tagged "Missing."
  4. When you find the missing library, uncheck it. Be sure to remember or write down the library's name.
  5. From the Debug menu, choose Compile filename.
  6. From the Tools menu, choose References.
  7. The library should no longer be tagged as "Missing." Check it and close the References dialog box.

I haven't run into this error in one of my projects in a long time. However, I still get mail about it, so it's still a problem.