msing libray's

D

dayton

when I open db it breaks to module and highlights "Str"
and pop-up says can't find project or library; what
library has the string functions? Also same problem
with "Date" function.
In references it show that "MsSys Ole control Module"
is missing. Where do I finf ths library?
 
L

Lee

Dayton,

I often see the same errors when I share an .MDB between two computers and
the libraries on the two computers aren't registered quite the same (say,
the second computer has a slightly newer version of a library than the
development computer).

A way to manually check this and correct it is to:
1) Open any code module
2) From the menu, pick Tools / References
3) You will probably see one or more libraries marked MISSING
4) Un-check any of the checked libraries and REMEMBER THAT LIBRARY'S EXACT
NAME
5) Click OK to accept your change.
6) Go right back into Tools / References, and check that library you
unchecked before.
7) Click OK to accept your change.

That process forces Access to refresh its library registration information.
You should no longer see any MISSING libraries. If you do, then those
libraries are probably actually missing, so you need to install them.

There is a way to automate the above steps. The CheckRefs function below
runs a trivial query that normally should run OK, but fails if the libraries
are out of sync. If the query returns an error, then CheckRefs calls
FixUpRefs to automatically perform steps 1 - 7, above. You would run
CheckRefs at the very start of your application.

The qryTestRef query is simply: SELECT Left("Hiya",1) AS Expr1

I adapted this code from a posting I found on a public forum (MSDN I think).
My apologies to the original author for misplacing their name.

Code follows.
Lee

========================================
Function CheckRefs()
Dim db As Database, rs As Recordset
Dim x
Set db = CurrentDb

On Error Resume Next

' Run the query qryTestRefs you created and trap for an error.
Set rs = db.OpenRecordset("qryTestRef", dbOpenDynaset)

' The if statement below checks for error 3075. If it encounters the
' error, it informs the user that it needs to fix the application.
' Error 3075 is the following:
' "Function isn't available in expressions in query expression..."

' Note: This function only checks for the error 3075. If you want it to
' check for other errors, you can modify the If statement. To have
' it check for any error, you can change it to the following:
' If Err.Number <> 0

If Err.Number = 3075 Then
MsgBox "This application has detected newer versions " _
& "of required files on your computer and will " _
& "now reconfigure itself. " _
& "This may take a moment."
Err.Clear
FixUpRefs
End If


End Function

Sub FixUpRefs()
Dim r As Reference, r1 As Reference
Dim s As String

' Look for the first reference in the database other
' than Access and Visual Basic for Applications.
For Each r In Application.References
If r.Name <> "Access" And r.Name <> "VBA" Then
Set r1 = r
Exit For
End If
Next
s = r1.FullPath

' Remove the Reference and add it back.
References.Remove r1
References.AddFromFile s

' Call a hidden SysCmd to automatically compile/save all modules.
Call SysCmd(504, 16483)
End Sub
========================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top